sierra20
asked on
Label always flickering
Hi
I have a form with a couple of label in it.
I can drag each one at a different position in the form.
But when i drag it, the label always flick.
When i drag the label, i use onmousemove to know the position of the cursor, then i move the label under the cursor, its at this moment that the klickering occur.
exemple :
procedure mousemove(sender:tobject; shifgt:tshiftstate; x,y:integer);
Begin
Label.left:=x-4;
Label.top:=y-4;
end;
Thanks
Sierra
I have a form with a couple of label in it.
I can drag each one at a different position in the form.
But when i drag it, the label always flick.
When i drag the label, i use onmousemove to know the position of the cursor, then i move the label under the cursor, its at this moment that the klickering occur.
exemple :
procedure mousemove(sender:tobject; shifgt:tshiftstate; x,y:integer);
Begin
Label.left:=x-4;
Label.top:=y-4;
end;
Thanks
Sierra
Why not just make sure that the label never floats under your cursor.
You can do this by adding a constant say
16 to your x and y values in all your calculations...
Rob ;-)
You can do this by adding a constant say
16 to your x and y values in all your calculations...
Rob ;-)
//this looks fine with no flickering..
procedure TForm1.FormMouseMove(Sende r: TObject; Shift: TShiftState; X,
Y: Integer);
begin
Label1.Top := Y-16;
Label1.Left := X-16;
end;
//just makes sure that the label never overlaps the cursor
Rob ;-)
procedure TForm1.FormMouseMove(Sende
Y: Integer);
begin
Label1.Top := Y-16;
Label1.Left := X-16;
end;
//just makes sure that the label never overlaps the cursor
Rob ;-)
Make the label transparent. It gets rid of stuff like that (it simply redraws it quicker!)
John.
John.
hmm,
just place a panel (alignment alclient) on your form and place on it your labels
meikl
just place a panel (alignment alclient) on your form and place on it your labels
meikl
Try on forms create :
MyLabel.Parent.DoubleBuffe red := True;
Where MyLabel is your Label's name.
You Won't get a flicker again..
MyLabel.Parent.DoubleBuffe
Where MyLabel is your Label's name.
You Won't get a flicker again..
Well, I've already suggested that!!
Look at the first comment in this question...
Look at the first comment in this question...
ASKER
Hi
I dont see this property (doubleBuffered), i work with delphi 3....
The label have to stay under the cursor when i drag it.
I forget to tell that there is some other code in the procedure Mousemove.
Sierra
I dont see this property (doubleBuffered), i work with delphi 3....
The label have to stay under the cursor when i drag it.
I forget to tell that there is some other code in the procedure Mousemove.
Sierra
>The label have to stay under the cursor when i drag it.
Why?
Rob ;-)
Why?
Rob ;-)
ASKER
Because the label represent an object that the user can move to an other emplacement. When the user will click on the mouse, the label will take this position.
Sierra
Sierra
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Meikl,
Yes its work, i just dont understand why the label dont flick now when you put it on a panel....
Sierra
Yes its work, i just dont understand why the label dont flick now when you put it on a panel....
Sierra
Label.SetBounds(x-4, y-4, Label.Width, Label.Height);
Play also with the "DoubleBuffered" property.
Perhaps "Label.DoubleBuffered := true" or "Form1.DoubleBuffered := true".
Does this help?
Regards, Madshi.