-
Notifications
You must be signed in to change notification settings - Fork 0
/
FormCreateImage.cs
186 lines (178 loc) · 5.49 KB
/
FormCreateImage.cs
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace FileSystem
{
/// <summary>
/// Summary description for FormCreateImage.
/// </summary>
public class FormCreateImage : System.Windows.Forms.Form
{
private System.Windows.Forms.Label label1;
public System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Label label3;
public System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.ErrorProvider errorProvider1;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public FormCreateImage()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label();
this.textBox2 = new System.Windows.Forms.TextBox();
this.errorProvider1 = new System.Windows.Forms.ErrorProvider();
this.SuspendLayout();
//
// label1
//
this.label1.Location = new System.Drawing.Point(24, 48);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(232, 24);
this.label1.TabIndex = 5;
this.label1.Text = "Èäåíòèôèêàòîð îáðàçà òîìà (8 ñèìâîëîâ):";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(264, 48);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(88, 20);
this.textBox1.TabIndex = 0;
this.textBox1.Text = "";
//
// label2
//
this.label2.Location = new System.Drawing.Point(8, 80);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(248, 24);
this.label2.TabIndex = 6;
this.label2.Text = "Ðàçìåð îáðàçà òîìà (â áëîêàõ ïî 4096 áàéò):";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// button1
//
this.button1.Location = new System.Drawing.Point(80, 112);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(64, 24);
this.button1.TabIndex = 2;
this.button1.Text = "OK";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.button2.Location = new System.Drawing.Point(224, 112);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(64, 24);
this.button2.TabIndex = 3;
this.button2.Text = "Îòìåíà";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// label3
//
this.label3.Location = new System.Drawing.Point(8, 16);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(344, 24);
this.label3.TabIndex = 4;
this.label3.Text = "Çàäàéòå íåîáõîäìóþ èíôîðìàöèþ äëÿ ñîçäàíèÿ îáðàçà òîìà.";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(264, 80);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(88, 20);
this.textBox2.TabIndex = 1;
this.textBox2.Text = "";
//
// errorProvider1
//
this.errorProvider1.ContainerControl = this;
//
// FormCreateImage
//
this.AcceptButton = this.button1;
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.CancelButton = this.button2;
this.ClientSize = new System.Drawing.Size(370, 149);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.label3);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.label2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Name = "FormCreateImage";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Ñîçäàíèå îáðàçà òîìà";
this.ResumeLayout(false);
}
#endregion
private void button1_Click(object sender, System.EventArgs e)
{
Int64 tmp;
try
{
tmp = Int64.Parse(this.textBox2.Text);
}
catch
{
errorProvider1.SetError(this.textBox2, "Íåîáõîäèìî ââåñòè ÷èñëî");
return;
}
if(tmp > 6)
{
this.DialogResult = DialogResult.OK;
this.Close();
errorProvider1.SetError(this.textBox2, "");
}
else errorProvider1.SetError(this.textBox2, "Ñëèøêîì ìàëîå êîëè÷åñòâî áëîêîâ");
}
private void button2_Click(object sender, System.EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
this.Close();
}
}
}