Board index » cppbuilder » Cross over Image

Cross over Image


2005-06-03 08:47:37 PM
cppbuilder96
Hi all,
I have an Image in a TPaintBox and I want draw a rectangle that move on
MouseMove
my source code:
PB1->Canvas->Pen->Color = clBlack;
PB1->Canvas->Pen->Style = psDot;
PB1->Canvas->Pen->Width = 2;
PB1->Canvas->Pen->Mode = pmNotXor;
PB1->Canvas->Brush->Style = bsClear;
// Cancel previous
PB1->Canvas->Brush->Color = clMedGray;
PB1->Canvas->FillRect(Rect(0,0,maxX,maxY));
//Redesign
DrawRectangle ......
but on Mouse move the image is not clear and the redesign is slow. The
cancel routine is slow?
There is another system to render the image to fast?
Thanks,
Antonio Cava
 
 

Re:Cross over Image

Antonio Cava wrote:
Quote
I have an Image in a TPaintBox and I want draw a rectangle that move on
MouseMove
Please clarify. You use the word Image. I hope you
do not mean a TImage. So you have a drawing in a TPaintBox
and you draw a rectangle while moving the mouse ?
Quote
// Cancel previous
PB1->Canvas->Brush->Color = clMedGray;
PB1->Canvas->FillRect(Rect(0,0,maxX,maxY));
You are erasing the whole surface of the TPaintBox.
Why ? If you move around a rectangle you only
should draw again those four lines. That does not take
time.
Quote
//Redesign
DrawRectangle ......

but on Mouse move the image is not clear and the redesign is slow. The
cancel routine is slow?
You did not show how you drawed the rectangle nor how you draw
the image.
image not clear ?
cancel routine ?
Hans.