-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathGoToXY.pas
64 lines (55 loc) · 1.33 KB
/
GoToXY.pas
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
unit GoToXY;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TFormGoTo = class(TForm)
LabelX: TLabel;
EditX: TEdit;
LabelY: TLabel;
EditY: TEdit;
Bevel1: TBevel;
ButtonCancel: TButton;
ButtonGoTo: TButton;
procedure ButtonGoToClick(Sender: TObject);
procedure ButtonCancelClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FormGoTo: TFormGoTo;
implementation
uses Main;
{$R *.dfm}
procedure TFormGoTo.ButtonGoToClick(Sender: TObject);
var X, Y:Extended;
begin
try
Y:=StrToFloat(EditY.Text);
except
begin
MessageBox(Handle, 'Êîîðäèíàòà Y íå óêàçàíà èëè óêàçàíà íå âåðíî.', '', MB_ICONWARNING or MB_OK);
Exit;
end;
end;
try
X:=StrToFloat(EditX.Text);
except
begin
MessageBox(Handle, 'Êîîðäèíàòà X íå óêàçàíà èëè óêàçàíà íå âåðíî.', '', MB_ICONWARNING or MB_OK);
Exit;
end;
end;
Engine.CenterPos.Y:= Round((Y*Engine.Step)+FormMain.DrawPanel.Height / 2);
Engine.CenterPos.X:=-Round((X*Engine.Step)-FormMain.DrawPanel.Width / 2);
OldMousePos:=Point(FormMain.DrawPanel.Width div 2, FormMain.DrawPanel.Height div 2);
Engine.CursorPoint.Coord:=ExtPoint(X, -Y);
end;
procedure TFormGoTo.ButtonCancelClick(Sender: TObject);
begin
Close;
end;
end.