-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGoToLineDialogUnit.pas
133 lines (121 loc) · 4.8 KB
/
GoToLineDialogUnit.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
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
unit GoToLineDialogUnit;
{$reference 'System.Windows.Forms.dll'}
{$reference 'System.Drawing.dll'}
uses
System,
System.Drawing,
System.Collections,
System.ComponentModel,
System.Windows.Forms;
type
GoToLineDialog = class(Form)
private
buttonOk: Button;
buttonCancel: Button;
labelMessage: System.Windows.Forms.Label;
numericUpDown: System.Windows.Forms.NumericUpDown;
function GetLine: integer;
begin
result := integer(numericUpDown.Value);
end;
procedure SetLine(value: integer);
begin
numericUpDown.Value := value;
end;
procedure SetLineCount(value: integer);
begin
numericUpDown.Maximum := value;
labelMessage.Text := Format('Íîìåð ñòðîêè (1 - {0}):', value);
end;
procedure buttonOk_Click(sender: object; e: System.EventArgs);
begin
self.DialogResult := System.Windows.Forms.DialogResult.OK;
self.Close;
end;
procedure buttonCancel_Click(sender: object; e: System.EventArgs);
begin
self.DialogResult := System.Windows.Forms.DialogResult.Cancel;
self.Close;
end;
procedure InitControls;
begin
self.buttonOk := new System.Windows.Forms.Button;
self.buttonCancel := new System.Windows.Forms.Button;
self.labelMessage := new System.Windows.Forms.Label;
self.numericUpDown := new System.Windows.Forms.NumericUpDown;
((System.ComponentModel.ISupportInitialize)(self.numericUpDown)).BeginInit;
self.SuspendLayout;
//
// buttonOk
//
self.buttonOk.Anchor := ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom or System.Windows.Forms.AnchorStyles.Right)));
self.buttonOk.Location := new System.Drawing.Point(105, 55);
self.buttonOk.Size := new System.Drawing.Size(75, 23);
self.buttonOk.TabIndex := 0;
self.buttonOk.Text := 'OK';
self.buttonOk.UseVisualStyleBackColor := true;
self.buttonOk.Click += self.buttonOk_Click;
//
// buttonCancel
//
self.buttonCancel.Anchor := ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom or System.Windows.Forms.AnchorStyles.Right)));
self.buttonCancel.DialogResult := System.Windows.Forms.DialogResult.Cancel;
self.buttonCancel.Location := new System.Drawing.Point(186, 55);
self.buttonCancel.Size := new System.Drawing.Size(75, 23);
self.buttonCancel.TabIndex := 1;
self.buttonCancel.Text := 'Îòìåíà';
self.buttonCancel.UseVisualStyleBackColor := true;
self.buttonCancel.Click += self.buttonCancel_Click;
//
// labelMessage
//
self.labelMessage.AutoSize := true;
self.labelMessage.Location := new System.Drawing.Point(12, 9);
self.labelMessage.Size := new System.Drawing.Size(111, 13);
self.labelMessage.TabIndex := 2;
self.labelMessage.Text := 'Íîìåð ñòðîêè (1 - max):';
//
// numericUpDown
//
self.numericUpDown.Anchor := ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top or System.Windows.Forms.AnchorStyles.Left)
or System.Windows.Forms.AnchorStyles.Right)));
self.numericUpDown.Location := new System.Drawing.Point(15, 27);
self.numericUpDown.Margin := new System.Windows.Forms.Padding(3, 5, 3, 5);
self.numericUpDown.Maximum := Decimal.One;
self.numericUpDown.Minimum := System.Decimal.One;
self.numericUpDown.Size := new System.Drawing.Size(246, 20);
self.numericUpDown.TabIndex := 3;
self.numericUpDown.Value := Decimal.One;
//
// GoToLineDialog
//
self.AcceptButton := self.buttonOk;
self.AutoScaleDimensions := new System.Drawing.SizeF(single(6), single(13));
self.AutoScaleMode := System.Windows.Forms.AutoScaleMode.Font;
self.CancelButton := self.buttonCancel;
self.ClientSize := new System.Drawing.Size(273, 90);
self.Controls.Add(self.numericUpDown);
self.Controls.Add(self.labelMessage);
self.Controls.Add(self.buttonCancel);
self.Controls.Add(self.buttonOk);
self.FormBorderStyle := System.Windows.Forms.FormBorderStyle.FixedDialog;
self.MaximizeBox := false;
self.MinimizeBox := false;
self.ShowIcon := false;
self.ShowInTaskbar := false;
self.StartPosition := System.Windows.Forms.FormStartPosition.CenterParent;
self.Text := 'Ïåðåéòè ê ñòðîêå';
((System.ComponentModel.ISupportInitialize)(self.numericUpDown)).EndInit;
self.ResumeLayout(false);
self.PerformLayout;
end;
public
constructor Create;
begin
InitControls;
end;
property Line: integer read GetLine write SetLine;
property LineCount: integer write SetLineCount;
end;
begin
end.