public
{ Public declarations }
Arr_pt: Array[0..3] Of TPoint;
DraggingPt: Boolean;
IndDraggingPt: Integer;
function PontoEm(x, y: Integer; Ponto: TPoint): Boolean;
//
procedure TForm1.Button1Click(Sender: TObject);
begin
Arr_pt[0] := Point(StrToInt(Edit1.Text), StrToInt(Edit3.Text));
Arr_pt[1] := Point(StrToInt(Edit3.Text), StrToInt(Edit4.Text));
Arr_pt[2] := Point(StrToInt(Edit5.Text), StrToInt(Edit6.Text));
Arr_pt[3] := Point(StrToInt(Edit7.Text), StrToInt(Edit8.Text));
PaintBox1.Refresh;
end;
procedure TForm1.FormShow(Sender: TObject);
begin
DraggingPt := False;
Button1.OnClick(Nil);
end;
procedure TForm1.PaintBox1Paint(Sender: TObject);
procedure DesenharPonto(Ponto: TPoint; CorPen: TColor; CorBrush: TColor);
begin
PaintBox1.Canvas.Pen.Color := CorPen;
PaintBox1.Canvas.Brush.Color := CorBrush;
PaintBox1.Canvas.Rectangle(Ponto.X-2, Ponto.Y-2, Ponto.X+2, Ponto.Y+2);
end;
procedure MoverPara(Ponto: TPoint);
begin
PaintBox1.Canvas.MoveTo(Ponto.x, Ponto.Y);
end;
procedure Linha(PontoInicial: TPoint; PontoFinal: TPoint; Cor: TColor);
begin
PaintBox1.Canvas.Pen.Color := Cor;
MoverPara(PontoInicial);
PaintBox1.Canvas.LineTo(PontoFinal.X, PontoFinal.Y);
end;
begin
With PaintBox1.Canvas Do
begin
Brush.Color := clWhite;
Pen.Color := clBlack;
FillRect(PaintBox1.ClientRect);
PolyBezier(Arr_pt);
Linha(Arr_pt[0], Arr_pt[1], clRed); // P1 e P2 ...
Linha(Arr_pt[3], Arr_pt[2], clRed); // P4 e P3 ...
DesenharPonto(Arr_pt[0], clBlack, clYellow);
DesenharPonto(Arr_pt[1], clBlack, clBlack);
DesenharPonto(Arr_pt[2], clBlack, clBlack);
DesenharPonto(Arr_pt[3], clBlack, clYellow);
end;
end;
function TForm1.PontoEm(x, y: Integer; Ponto: TPoint): Boolean;
begin
RESULT := (Ponto.X >= x-2) And (Ponto.X <= x+2)
And (Ponto.y >= y-2) And (Ponto.y <= y+2);
end;
procedure TForm1.PaintBox1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
DraggingPt := False;
If PontoEm(x, y, Arr_pt[0])
Then Begin
DraggingPt := True;
IndDraggingPt := 0;
End;
If PontoEm(x, y, Arr_pt[1])
Then Begin
DraggingPt := True;
IndDraggingPt := 1;
End;
If PontoEm(x, y, Arr_pt[2])
Then Begin
DraggingPt := True;
IndDraggingPt := 2;
End;
If PontoEm(x, y, Arr_pt[3])
Then Begin
DraggingPt := True;
IndDraggingPt := 3;
End;
If DraggingPt
Then PaintBox1.Cursor := crHandPoint;
end;
procedure TForm1.PaintBox1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
If DraggingPt
Then Begin
Arr_pt[IndDraggingPt] := Point(x, y);
TEdit( FindComponent('E' + IntToStr(IndDraggingPt)+ 'X') ).Text := IntToStr(x);
TEdit( FindComponent('E' + IntToStr(IndDraggingPt)+ 'Y') ).Text := IntToStr(y);
PaintBox1Paint(Nil);
End
Else
If PontoEm(x, y, Arr_pt[0]) Or PontoEm(x, y, Arr_pt[1])
Or PontoEm(x, y, Arr_pt[2]) Or PontoEm(x, y, Arr_pt[3])
Then PaintBox1.Cursor := crHandPoint
Else PaintBox1.Cursor := crDefault;
end;
procedure TForm1.PaintBox1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
If DraggingPt
Then Begin
PaintBox1MouseMove(PaintBox1, Shift, x, y);
DraggingPt := False;
PaintBox1.Cursor := crDefault;
End;
end;
![this slowpoke moves](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5eZ-z9sz_xVkiSuk05eWEm8kREjFQ8WhbXnkLcMVqPzdlLimb0GXqLX3rOzhg5NVomMZ8I4zCFTeaWrQ2lmjSLDGlYkNI6JZHPeG0UtdVbrZ2bw1_u0ZZ5ojdpvOF06VCXtDaRAfnjqGgd218vY-cM757Qp__KzH2RupTvJwSR4cG3HuhdeUqOb2o1cpr/s320/Hello%20World.gif)
Calculate Canvas Bezier
Abonnieren
Posts (Atom)
Beliebte Posts
-
Network Source Code Update Source Code Network Update : https://asciigen.blogspot.com/p/network.html Send Message 1.0 Source Server Client ...
-
Windows Key Sniffer 0.82 - Update 08/2024 Der Windows Key Sniffer hat mir im Laufe der Zeit viel Arbeit erspart und unterstützt, viele Wi...
-
Windows Defender Bypass Version 0.75 - Update 11/2024 Den Windows 10-eigenen Virenschutz Defender kann man auf mehreren Wegen abschalten,...
-
ASCii GIF Animator Update Version 0.68 (32 bit) - 11/2024 Bei dieser überarbeiteten Version ist die Kompatibilität zu den verschiedenen GIF...
-
MD5 Hacker v.0.26 - Update 08.2024 MD5 Hashs sollten eigentlich nicht entschlüsselt werden können. Jedoch gibt es Tools, mit welchen auch ...
-
Host Editor Version 0.64 - Update 11/2024 Hosts File Editor allows for the easy editing of host files and backup creation. Create your own h...
-
Dir Sniffer Version 0.08 - Update 08/2024 Dir Sniffer ist ein kleines aber nützliches Tool um herauszufinden, was ihr Programm auf ihrem...
-
Oldskool Font Generator v.0.29 - Update 11/2023 Das Tool stell 508 Bitmap Fonts zu Verfügung. Eigene Fonts können integriert werden, sie...
-
ASCii Text Creator v.0.24 - Update 11.2023 * Add BugFix Gui Move Message Send * Add 447 Figlet Font Pack * Fixed Invert Unicode Function * ...
Keine Kommentare:
Kommentar veröffentlichen