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: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89:
| private z,x1,y1,x2,y2,radius:integer; rechteck, kreis, zeichnen, punkt, radier,dreieck,linie :boolean; farbe:Tcolor; public end;
var Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); begin panel1.caption:=IntToStr(x)+' : '+IntToStr(y); if shift=[ssLeft] then begin if rechteck then begin canvas.Rectangle(x1,y1,x2,y2); x2:=x;y2:=y; canvas.rectangle(x1,y1,x2,y2); end; if kreis then begin radius:=round(sqrt(sqr(x2-x1)+sqr(y2-y1))); canvas.Ellipse(x1-radius,y1-radius,x1+radius,y1+radius); x2:=x;y2:=y; radius:=round(sqrt(sqr(x2-x1)+sqr(y2-y1))); canvas.Ellipse(x1-radius,y1-radius,x1+radius,y1+radius); end; if zeichnen then begin canvas.MoveTo(x1,y1); x1:=x;y1:=y; x2:=x;y2:=y; canvas.LineTo(x2,y2); z:=strtoint(edit1.text); canvas.pen.Width:=z; Canvas.Pen.Color := ColorGrid2.foregroundColor;
end; if radier then begin z:=StrToInt(edit1.Text); canvas.Pen.Width:=z; canvas.Pen.Mode:=pmcopy; canvas.Pen.Color:=Form1.color; canvas.MoveTo(x1,y1); x1:=x;y1:=y; x2:=x;y2:=y; canvas.LineTo(x2,y2); canvas.Pen.Width:=1; canvas.Pen.Mode:=pmNotXor; end; if linie then begin canvas.moveto(x1,y1); canvas.LineTo(x,y); canvas.pen.width:=z; end; end; end;
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin if shift=[ssLeft] then begin x1:=x;y1:=y;x2:=x;y2:=y; if punkt then canvas.Pixels[x,y]:=clblack; end; end;
procedure TForm1.FormCreate(Sender: TObject); begin canvas.Pen.Mode:=pmNotXor; canvas.Pen.style:=pssolid; canvas.Brush.Style:=bsclear; canvas.Brush.Color:=farbe; rechteck:=false; kreis:=false;zeichnen:=false;punkt:=false;radier:=false; end; |