1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52:
| procedure TMainDia.PaintBox1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin if Draw then begin PaintBox1.Canvas.MoveTo(x,y); Buttonpressed := true; XOld:=x; YOld:=y; inc(countW,1); end; end;
procedure TMainDia.PaintBox1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); var i : integer; begin if Draw then begin PaintBox1.Canvas.MoveTo(XOld,YOld); PaintBox1.Canvas.LineTo(x,y); Pos1[CountW].X := XOld; Pos1[CountW].Y := YOld; Pos2[CountW].X := X; Pos2[CountW].Y := Y; for i := 1 to CountW do begin PaintBox1.Canvas.MoveTo(Pos1[CountW].X,Pos1[CountW].Y); PaintBox1.Canvas.LineTo(Pos2[CountW].X,Pos2[CountW].Y); end; Buttonpressed := false; end; end;
procedure TMainDia.PaintBox1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); var i : integer; begin if (Draw) and (Buttonpressed) then begin PaintBox1.Canvas.FloodFill(8,16,clgray,fsBorder); PaintBox1.Canvas.MoveTo(XOld,YOld); PaintBox1.Canvas.LineTo(x,y); for i := 1 to CountW do begin PaintBox1.Canvas.MoveTo(Pos1[CountW].X,Pos1[CountW].Y); PaintBox1.Canvas.LineTo(Pos2[CountW].X,Pos2[CountW].Y); end; end; end; |