Hi,

I have a Timage on a panel and I want to draw a cross on the image as I move my mouse on the image. I am drawing the cross using the canvas of the image. The drawing of the mouse works fine but the problem I am encountring is that when I move the mouse again the previous cross that was drawn is still there. I have tried to refresh the Image and the canvas but that hasn't helped. Any suggestions...

Thanks in advance.

TCanvas is something like HDC (wrapper on it).
When you begin to draw cross or something you want, you may fill full client area of TImage with background color.
Use method FillRect of TCanvas class.

what libraries, compiler, and operating system are you using to do all that drawing? If you want the previous cross to disappear when you move the mouse you will have to redraw the cross in the same color as the canvas background. It doesn't disappear on its own.

[edit]Or, more likey what ^^^ he said [/edit]

Don't forget to make call of Update method of TImage class after all.

Notes:
BCB 6 is Builder C++ Version 6.
TCanvas is builder class, like CDC in MFC.

TCanvas is something like HDC (wrapper on it).
When you begin to draw cross or something you want, you may fill full client area of TImage with background color.
Use method FillRect of TCanvas class.

Thanks,

This worked fine. I should have tried this earlier but just thought that there was a another way. What a waste of time. This was such an easy fix.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.