Delphi Tutorial


 

 

track mouse movements

 

Download this example

               Following procedure set shape color into black and change the default shape cursor. You have to repeat this procedure for each shape. Here is only for one shape. It is similar for all the shape.

 

procedure TForm1.Shape1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
        If (CheckBox1.Checked) And         (Shape1.Brush.Color<>clBlack) Then
                Shape1.Brush.Color:=clBlack;
        If (CheckBox2.Checked) And (Shape1.Cursor<>crDrag)         Then
                Shape1.Cursor:=crDrag;
end;

 

Use this procedure to set shape color and cursor shape to default.

 

procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
Var
X1, X2, Y1, Y2 : Integer;
begin
      If Shape1.Brush.Color=clBlack Then
      Shape1.Brush.Color:=clWhite;
      If Shape2.Brush.Color=clBlack Then
      Shape2.Brush.Color:=clWhite;
      If Shape3.Brush.Color=clBlack Then
      Shape3.Brush.Color:=clWhite;
      If Shape4.Brush.Color=clBlack Then
      Shape4.Brush.Color:=clWhite;
      If Shape5.Brush.Color=clBlack Then
      Shape5.Brush.Color:=clWhite;
      If Shape6.Brush.Color=clBlack Then
      Shape6.Brush.Color:=clWhite;
      If Shape7.Brush.Color=clBlack Then
      Shape7.Brush.Color:=clWhite;
      If Shape1.Cursor<>crDefault Then
      Shape1.Cursor:=crDefault;
      If Shape2.Cursor<>crDefault Then
      Shape2.Cursor:=crDefault;
      If Shape3.Cursor<>crDefault Then
      Shape3.Cursor:=crDefault;
      If Shape4.Cursor<>crDefault Then
      Shape4.Cursor:=crDefault;
      If Shape5.Cursor<>crDefault Then
      Shape5.Cursor:=crDefault;
      If Shape6.Cursor<>crDefault Then
      Shape6.Cursor:=crDefault;
      If Shape7.Cursor<>crDefault Then
      Shape7.Cursor:=crDefault;
      Label1.Caption:='X : '+IntToStr(X)+' Y : '+IntToStr(Y);
end;


DOWNLOAD this example

Click here to download this complete example for Delphi 6. (File size 4KB)

 

 

Go top

 


Previous Page First Page Next Page
 
Copyright © 2002 digitalcoding.com. All rights reserved.