質問編集履歴
5
再度修正させていただきました。よろしくお願いします。
test
CHANGED
File without changes
|
test
CHANGED
@@ -10,488 +10,488 @@
|
|
10
10
|
|
11
11
|
|
12
12
|
|
13
|
+
|
14
|
+
|
15
|
+
PictureBoxに線を書き出すアプリを作成したのですが、マウスでクリック操作すると上手くPictureBoxに線が書き出されるのですが、
|
16
|
+
|
17
|
+
キーボードでEnterを押すと書き出された線がすぐに消えてしまいます。
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
エンターキー操作でもクリック操作と同じ結果を得るにはどうすればよろしいのでしょうか?
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
visual C#
|
26
|
+
|
27
|
+
|
28
|
+
|
13
29
|
```
|
14
30
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
31
|
+
|
32
|
+
|
33
|
+
### 該当のソースコード
|
34
|
+
|
35
|
+
using System;
|
36
|
+
|
37
|
+
using System.Collections.Generic;
|
38
|
+
|
39
|
+
using System.ComponentModel;
|
40
|
+
|
41
|
+
using System.Data;
|
42
|
+
|
43
|
+
using System.Drawing;
|
44
|
+
|
45
|
+
using System.Linq;
|
46
|
+
|
47
|
+
using System.Text;
|
48
|
+
|
49
|
+
using System.Threading.Tasks;
|
50
|
+
|
51
|
+
using System.Windows.Forms;
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
namespace BoxMaterialApp
|
56
|
+
|
57
|
+
{
|
58
|
+
|
59
|
+
public partial class Form5 : Form
|
60
|
+
|
61
|
+
{
|
62
|
+
|
63
|
+
//x軸,y軸の始点の決定
|
64
|
+
|
65
|
+
int x = 100;
|
66
|
+
|
67
|
+
int y = 20;
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
//ボックスの高さ、テキストボックス1
|
72
|
+
|
73
|
+
private double box_h = 0;
|
74
|
+
|
75
|
+
//ボックスと扉の下面の隙間、テキストボックス2
|
76
|
+
|
77
|
+
private double gap = 0;
|
78
|
+
|
79
|
+
//扉の高さ、テキストボックス3
|
80
|
+
|
81
|
+
private double door_h = 0;
|
82
|
+
|
83
|
+
//扉下面からハンドル上面までの高さ、テキストボックス4
|
84
|
+
|
85
|
+
private double handle_h = 0;
|
86
|
+
|
87
|
+
//上面ガーター部の曲げの値、テキストボックス5
|
88
|
+
|
89
|
+
private double garter_over = 0;
|
90
|
+
|
91
|
+
//下面ガーター部の曲げの値、テキストボックス6
|
92
|
+
|
93
|
+
private double garter_under = 0;
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
public Form5()
|
98
|
+
|
99
|
+
{
|
100
|
+
|
101
|
+
InitializeComponent();
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
//ピクチャーボックスをクリア
|
106
|
+
|
107
|
+
var g = pictureBox2.CreateGraphics();
|
108
|
+
|
109
|
+
g.Clear(Color.WhiteSmoke);
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
//ボタンを隠す
|
114
|
+
|
115
|
+
button2.Visible = false;
|
116
|
+
|
117
|
+
label1.Visible = false;
|
118
|
+
|
119
|
+
textBox1.Visible = false;
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
button3.Visible = false;
|
124
|
+
|
125
|
+
label2.Visible = false;
|
126
|
+
|
127
|
+
textBox2.Visible = false;
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
button4.Visible = false;
|
132
|
+
|
133
|
+
label3.Visible = false;
|
134
|
+
|
135
|
+
textBox3.Visible = false;
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
button5.Visible = false;
|
140
|
+
|
141
|
+
label4.Visible = false;
|
142
|
+
|
143
|
+
textBox4.Visible = false;
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
button6.Visible = false;
|
148
|
+
|
149
|
+
label5.Visible = false;
|
150
|
+
|
151
|
+
textBox5.Visible = false;
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
button7.Visible = false;
|
156
|
+
|
157
|
+
label6.Visible = false;
|
158
|
+
|
159
|
+
textBox6.Visible = false;
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
button8.Visible = false;
|
164
|
+
|
165
|
+
comboBox1.Visible = false;
|
166
|
+
|
167
|
+
label7.Visible = false;
|
168
|
+
|
169
|
+
label8.Visible = false;
|
170
|
+
|
171
|
+
}
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
private bool checkValue()
|
176
|
+
|
177
|
+
{
|
178
|
+
|
179
|
+
//テキストボックスの値をdouble型に変換してフィールドに格納
|
180
|
+
|
181
|
+
//成功すればtrueを返す
|
182
|
+
|
183
|
+
try
|
184
|
+
|
185
|
+
{
|
186
|
+
|
187
|
+
box_h = Convert.ToDouble(textBox1.Text);
|
188
|
+
|
189
|
+
return true;
|
190
|
+
|
191
|
+
}
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
//int型に変換できないときはメッセージを送信
|
196
|
+
|
197
|
+
//falseを返す
|
198
|
+
|
199
|
+
catch
|
200
|
+
|
201
|
+
{
|
202
|
+
|
203
|
+
MessageBox.Show("半角数字で入力してください。", "エラー");
|
204
|
+
|
205
|
+
return false;
|
206
|
+
|
207
|
+
}
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
//テキストボックスをクリアする。
|
212
|
+
|
213
|
+
finally
|
214
|
+
|
215
|
+
{
|
216
|
+
|
217
|
+
textBox1.Clear();
|
218
|
+
|
219
|
+
}
|
220
|
+
|
221
|
+
}
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
private bool checkValue2()
|
226
|
+
|
227
|
+
{
|
228
|
+
|
229
|
+
//テキストボックスの値をdouble型に変換してフィールドに格納
|
230
|
+
|
231
|
+
//成功すればtrueを返す
|
232
|
+
|
233
|
+
try
|
234
|
+
|
235
|
+
{
|
236
|
+
|
237
|
+
gap = Convert.ToDouble(textBox2.Text);
|
238
|
+
|
239
|
+
return true;
|
240
|
+
|
241
|
+
}
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
//int型に変換できないときはメッセージを送信
|
246
|
+
|
247
|
+
//falseを返す
|
248
|
+
|
249
|
+
catch
|
250
|
+
|
251
|
+
{
|
252
|
+
|
253
|
+
MessageBox.Show("半角数字で入力してください。", "エラー");
|
254
|
+
|
255
|
+
return false;
|
256
|
+
|
257
|
+
}
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
//テキストボックスをクリアする。
|
262
|
+
|
263
|
+
finally
|
264
|
+
|
265
|
+
{
|
266
|
+
|
267
|
+
textBox2.Clear();
|
268
|
+
|
269
|
+
}
|
270
|
+
|
271
|
+
}
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
private void button1_Click(object sender, EventArgs e)
|
278
|
+
|
279
|
+
{
|
280
|
+
|
281
|
+
//ボタンを隠す
|
282
|
+
|
283
|
+
button1.Visible = false;
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
//ボタンの表示
|
288
|
+
|
289
|
+
button2.Visible = true;
|
290
|
+
|
291
|
+
label1.Visible = true;
|
292
|
+
|
293
|
+
textBox1.Visible = true;
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
//カーソルのフォーカス
|
298
|
+
|
299
|
+
textBox1.Focus();
|
300
|
+
|
301
|
+
// button2 を [承諾] ボタンに設定する
|
302
|
+
|
303
|
+
this.AcceptButton = this.button2;
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
//ピクチャーボックスの宣言
|
308
|
+
|
309
|
+
var g = pictureBox2.CreateGraphics();
|
310
|
+
|
311
|
+
g.Clear(Color.WhiteSmoke);
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
//太線の宣言
|
316
|
+
|
317
|
+
var bold = new Pen(Color.Black, 2);
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
//本体フレーム(上)を表示
|
322
|
+
|
323
|
+
var points1 = new Point[5];
|
324
|
+
|
325
|
+
points1[0] = new Point(x, y);
|
326
|
+
|
327
|
+
points1[1] = new Point((x + 50), y);
|
328
|
+
|
329
|
+
points1[2] = new Point((x + 50), (y + 50));
|
330
|
+
|
331
|
+
points1[3] = new Point((x + 75), (y + 50));
|
332
|
+
|
333
|
+
points1[4] = new Point((x + 75), (y + 25));
|
334
|
+
|
335
|
+
g.DrawLines(bold, points1);
|
336
|
+
|
337
|
+
|
338
|
+
|
339
|
+
//本体フレーム(下)を表示
|
340
|
+
|
341
|
+
var points2 = new Point[5];
|
342
|
+
|
343
|
+
points2[0] = new Point(x, (y + 300));
|
344
|
+
|
345
|
+
points2[1] = new Point((x + 50), (y + 300));
|
346
|
+
|
347
|
+
points2[2] = new Point((x + 50), (y + 250));
|
348
|
+
|
349
|
+
points2[3] = new Point((x + 75), (y + 250));
|
350
|
+
|
351
|
+
points2[4] = new Point((x + 75), (y + 275));
|
352
|
+
|
353
|
+
g.DrawLines(bold, points2);
|
354
|
+
|
355
|
+
|
356
|
+
|
357
|
+
//扉表示
|
358
|
+
|
359
|
+
var points3 = new Point[4];
|
360
|
+
|
361
|
+
points3[0] = new Point((x + 60), (y + 10));
|
362
|
+
|
363
|
+
points3[1] = new Point((x + 85), (y + 10));
|
364
|
+
|
365
|
+
points3[2] = new Point((x + 85), (y + 290));
|
366
|
+
|
367
|
+
points3[3] = new Point((x + 60), (y + 290));
|
368
|
+
|
369
|
+
g.DrawLines(bold, points3);
|
370
|
+
|
371
|
+
|
372
|
+
|
373
|
+
//縦線の寸法線を表示
|
374
|
+
|
375
|
+
g.DrawLine(Pens.Blue, (x + 95), y, (x + 140), y);
|
376
|
+
|
377
|
+
g.DrawLine(Pens.Blue, (x + 130), y, (x + 130), (y + 300));
|
378
|
+
|
379
|
+
g.DrawLine(Pens.Blue, (x + 95), (y + 300), (x + 140), (y + 300));
|
380
|
+
|
381
|
+
|
382
|
+
|
383
|
+
}
|
384
|
+
|
385
|
+
|
386
|
+
|
387
|
+
private void button2_Click(object sender, EventArgs e)
|
388
|
+
|
389
|
+
{
|
390
|
+
|
391
|
+
if (checkValue())
|
392
|
+
|
393
|
+
{
|
394
|
+
|
395
|
+
//ボタンを隠す
|
396
|
+
|
397
|
+
button2.Visible = false;
|
398
|
+
|
399
|
+
label1.Visible = false;
|
400
|
+
|
401
|
+
textBox1.Visible = false;
|
402
|
+
|
403
|
+
|
404
|
+
|
405
|
+
//ボタンの表示
|
406
|
+
|
407
|
+
button3.Visible = true;
|
408
|
+
|
409
|
+
label2.Visible = true;
|
410
|
+
|
411
|
+
textBox2.Visible = true;
|
412
|
+
|
413
|
+
|
414
|
+
|
415
|
+
//カーソルのフォーカス
|
416
|
+
|
417
|
+
textBox2.Focus();
|
418
|
+
|
419
|
+
|
420
|
+
|
421
|
+
// button3 を [承諾] ボタンに設定する
|
422
|
+
|
423
|
+
this.AcceptButton = this.button3;
|
424
|
+
|
425
|
+
|
426
|
+
|
427
|
+
//ピクチャーボックスをクリア
|
428
|
+
|
429
|
+
var g = pictureBox2.CreateGraphics();
|
430
|
+
|
431
|
+
g.Clear(Color.WhiteSmoke);
|
432
|
+
|
433
|
+
|
434
|
+
|
435
|
+
//太線の宣言
|
436
|
+
|
437
|
+
var bold = new Pen(Color.Black, 2);
|
438
|
+
|
439
|
+
|
440
|
+
|
441
|
+
//本体フレーム(下)を表示
|
442
|
+
|
443
|
+
var points2 = new Point[5];
|
444
|
+
|
445
|
+
points2[0] = new Point(x, (y + 200));
|
446
|
+
|
447
|
+
points2[1] = new Point((x + 50), (y + 200));
|
448
|
+
|
449
|
+
points2[2] = new Point((x + 50), (y + 150));
|
450
|
+
|
451
|
+
points2[3] = new Point((x + 75), (y + 150));
|
452
|
+
|
453
|
+
points2[4] = new Point((x + 75), (y + 175));
|
454
|
+
|
455
|
+
g.DrawLines(bold, points2);
|
456
|
+
|
457
|
+
|
458
|
+
|
459
|
+
//扉表示
|
460
|
+
|
461
|
+
var points3 = new Point[3];
|
462
|
+
|
463
|
+
points3[0] = new Point((x + 85), (y + 50));
|
464
|
+
|
465
|
+
points3[1] = new Point((x + 85), (y + 190));
|
466
|
+
|
467
|
+
points3[2] = new Point((x + 60), (y + 190));
|
468
|
+
|
469
|
+
g.DrawLines(bold, points3);
|
470
|
+
|
471
|
+
|
472
|
+
|
473
|
+
//縦線の寸法線を表示
|
474
|
+
|
475
|
+
g.DrawLine(Pens.Blue, (x + 95), (y + 190), (x + 140), (y + 190));
|
476
|
+
|
477
|
+
g.DrawLine(Pens.Blue, (x + 130), (y + 190), (x + 130), (y + 200));
|
478
|
+
|
479
|
+
g.DrawLine(Pens.Blue, (x + 95), (y + 200), (x + 140), (y + 200));
|
480
|
+
|
481
|
+
}
|
482
|
+
|
483
|
+
}
|
484
|
+
|
485
|
+
}
|
486
|
+
|
487
|
+
}
|
488
|
+
|
489
|
+
|
28
490
|
|
29
491
|
```
|
30
492
|
|
31
493
|
|
32
494
|
|
33
|
-
### 該当のソースコード
|
34
|
-
|
35
|
-
using System;
|
36
|
-
|
37
|
-
using System.Collections.Generic;
|
38
|
-
|
39
|
-
using System.ComponentModel;
|
40
|
-
|
41
|
-
using System.Data;
|
42
|
-
|
43
|
-
using System.Drawing;
|
44
|
-
|
45
|
-
using System.Linq;
|
46
|
-
|
47
|
-
using System.Text;
|
48
|
-
|
49
|
-
using System.Threading.Tasks;
|
50
|
-
|
51
|
-
using System.Windows.Forms;
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
namespace BoxMaterialApp
|
56
|
-
|
57
|
-
{
|
58
|
-
|
59
|
-
public partial class Form5 : Form
|
60
|
-
|
61
|
-
{
|
62
|
-
|
63
|
-
//x軸,y軸の始点の決定
|
64
|
-
|
65
|
-
int x = 100;
|
66
|
-
|
67
|
-
int y = 20;
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
//ボックスの高さ、テキストボックス1
|
72
|
-
|
73
|
-
private double box_h = 0;
|
74
|
-
|
75
|
-
//ボックスと扉の下面の隙間、テキストボックス2
|
76
|
-
|
77
|
-
private double gap = 0;
|
78
|
-
|
79
|
-
//扉の高さ、テキストボックス3
|
80
|
-
|
81
|
-
private double door_h = 0;
|
82
|
-
|
83
|
-
//扉下面からハンドル上面までの高さ、テキストボックス4
|
84
|
-
|
85
|
-
private double handle_h = 0;
|
86
|
-
|
87
|
-
//上面ガーター部の曲げの値、テキストボックス5
|
88
|
-
|
89
|
-
private double garter_over = 0;
|
90
|
-
|
91
|
-
//下面ガーター部の曲げの値、テキストボックス6
|
92
|
-
|
93
|
-
private double garter_under = 0;
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
public Form5()
|
98
|
-
|
99
|
-
{
|
100
|
-
|
101
|
-
InitializeComponent();
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
//ピクチャーボックスをクリア
|
106
|
-
|
107
|
-
var g = pictureBox2.CreateGraphics();
|
108
|
-
|
109
|
-
g.Clear(Color.WhiteSmoke);
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
//ボタンを隠す
|
114
|
-
|
115
|
-
button2.Visible = false;
|
116
|
-
|
117
|
-
label1.Visible = false;
|
118
|
-
|
119
|
-
textBox1.Visible = false;
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
button3.Visible = false;
|
124
|
-
|
125
|
-
label2.Visible = false;
|
126
|
-
|
127
|
-
textBox2.Visible = false;
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
button4.Visible = false;
|
132
|
-
|
133
|
-
label3.Visible = false;
|
134
|
-
|
135
|
-
textBox3.Visible = false;
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
button5.Visible = false;
|
140
|
-
|
141
|
-
label4.Visible = false;
|
142
|
-
|
143
|
-
textBox4.Visible = false;
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
button6.Visible = false;
|
148
|
-
|
149
|
-
label5.Visible = false;
|
150
|
-
|
151
|
-
textBox5.Visible = false;
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
button7.Visible = false;
|
156
|
-
|
157
|
-
label6.Visible = false;
|
158
|
-
|
159
|
-
textBox6.Visible = false;
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
button8.Visible = false;
|
164
|
-
|
165
|
-
comboBox1.Visible = false;
|
166
|
-
|
167
|
-
label7.Visible = false;
|
168
|
-
|
169
|
-
label8.Visible = false;
|
170
|
-
|
171
|
-
}
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
private bool checkValue()
|
176
|
-
|
177
|
-
{
|
178
|
-
|
179
|
-
//テキストボックスの値をdouble型に変換してフィールドに格納
|
180
|
-
|
181
|
-
//成功すればtrueを返す
|
182
|
-
|
183
|
-
try
|
184
|
-
|
185
|
-
{
|
186
|
-
|
187
|
-
box_h = Convert.ToDouble(textBox1.Text);
|
188
|
-
|
189
|
-
return true;
|
190
|
-
|
191
|
-
}
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
//int型に変換できないときはメッセージを送信
|
196
|
-
|
197
|
-
//falseを返す
|
198
|
-
|
199
|
-
catch
|
200
|
-
|
201
|
-
{
|
202
|
-
|
203
|
-
MessageBox.Show("半角数字で入力してください。", "エラー");
|
204
|
-
|
205
|
-
return false;
|
206
|
-
|
207
|
-
}
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
//テキストボックスをクリアする。
|
212
|
-
|
213
|
-
finally
|
214
|
-
|
215
|
-
{
|
216
|
-
|
217
|
-
textBox1.Clear();
|
218
|
-
|
219
|
-
}
|
220
|
-
|
221
|
-
}
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
private bool checkValue2()
|
226
|
-
|
227
|
-
{
|
228
|
-
|
229
|
-
//テキストボックスの値をdouble型に変換してフィールドに格納
|
230
|
-
|
231
|
-
//成功すればtrueを返す
|
232
|
-
|
233
|
-
try
|
234
|
-
|
235
|
-
{
|
236
|
-
|
237
|
-
gap = Convert.ToDouble(textBox2.Text);
|
238
|
-
|
239
|
-
return true;
|
240
|
-
|
241
|
-
}
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
//int型に変換できないときはメッセージを送信
|
246
|
-
|
247
|
-
//falseを返す
|
248
|
-
|
249
|
-
catch
|
250
|
-
|
251
|
-
{
|
252
|
-
|
253
|
-
MessageBox.Show("半角数字で入力してください。", "エラー");
|
254
|
-
|
255
|
-
return false;
|
256
|
-
|
257
|
-
}
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
//テキストボックスをクリアする。
|
262
|
-
|
263
|
-
finally
|
264
|
-
|
265
|
-
{
|
266
|
-
|
267
|
-
textBox2.Clear();
|
268
|
-
|
269
|
-
}
|
270
|
-
|
271
|
-
}
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
private void button1_Click(object sender, EventArgs e)
|
278
|
-
|
279
|
-
{
|
280
|
-
|
281
|
-
//ボタンを隠す
|
282
|
-
|
283
|
-
button1.Visible = false;
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
//ボタンの表示
|
288
|
-
|
289
|
-
button2.Visible = true;
|
290
|
-
|
291
|
-
label1.Visible = true;
|
292
|
-
|
293
|
-
textBox1.Visible = true;
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
//カーソルのフォーカス
|
298
|
-
|
299
|
-
textBox1.Focus();
|
300
|
-
|
301
|
-
// button2 を [承諾] ボタンに設定する
|
302
|
-
|
303
|
-
this.AcceptButton = this.button2;
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
//ピクチャーボックスの宣言
|
308
|
-
|
309
|
-
var g = pictureBox2.CreateGraphics();
|
310
|
-
|
311
|
-
g.Clear(Color.WhiteSmoke);
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
//太線の宣言
|
316
|
-
|
317
|
-
var bold = new Pen(Color.Black, 2);
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
//本体フレーム(上)を表示
|
322
|
-
|
323
|
-
var points1 = new Point[5];
|
324
|
-
|
325
|
-
points1[0] = new Point(x, y);
|
326
|
-
|
327
|
-
points1[1] = new Point((x + 50), y);
|
328
|
-
|
329
|
-
points1[2] = new Point((x + 50), (y + 50));
|
330
|
-
|
331
|
-
points1[3] = new Point((x + 75), (y + 50));
|
332
|
-
|
333
|
-
points1[4] = new Point((x + 75), (y + 25));
|
334
|
-
|
335
|
-
g.DrawLines(bold, points1);
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
//本体フレーム(下)を表示
|
340
|
-
|
341
|
-
var points2 = new Point[5];
|
342
|
-
|
343
|
-
points2[0] = new Point(x, (y + 300));
|
344
|
-
|
345
|
-
points2[1] = new Point((x + 50), (y + 300));
|
346
|
-
|
347
|
-
points2[2] = new Point((x + 50), (y + 250));
|
348
|
-
|
349
|
-
points2[3] = new Point((x + 75), (y + 250));
|
350
|
-
|
351
|
-
points2[4] = new Point((x + 75), (y + 275));
|
352
|
-
|
353
|
-
g.DrawLines(bold, points2);
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
//扉表示
|
358
|
-
|
359
|
-
var points3 = new Point[4];
|
360
|
-
|
361
|
-
points3[0] = new Point((x + 60), (y + 10));
|
362
|
-
|
363
|
-
points3[1] = new Point((x + 85), (y + 10));
|
364
|
-
|
365
|
-
points3[2] = new Point((x + 85), (y + 290));
|
366
|
-
|
367
|
-
points3[3] = new Point((x + 60), (y + 290));
|
368
|
-
|
369
|
-
g.DrawLines(bold, points3);
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
//縦線の寸法線を表示
|
374
|
-
|
375
|
-
g.DrawLine(Pens.Blue, (x + 95), y, (x + 140), y);
|
376
|
-
|
377
|
-
g.DrawLine(Pens.Blue, (x + 130), y, (x + 130), (y + 300));
|
378
|
-
|
379
|
-
g.DrawLine(Pens.Blue, (x + 95), (y + 300), (x + 140), (y + 300));
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
}
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
private void button2_Click(object sender, EventArgs e)
|
388
|
-
|
389
|
-
{
|
390
|
-
|
391
|
-
if (checkValue())
|
392
|
-
|
393
|
-
{
|
394
|
-
|
395
|
-
//ボタンを隠す
|
396
|
-
|
397
|
-
button2.Visible = false;
|
398
|
-
|
399
|
-
label1.Visible = false;
|
400
|
-
|
401
|
-
textBox1.Visible = false;
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
//ボタンの表示
|
406
|
-
|
407
|
-
button3.Visible = true;
|
408
|
-
|
409
|
-
label2.Visible = true;
|
410
|
-
|
411
|
-
textBox2.Visible = true;
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
//カーソルのフォーカス
|
416
|
-
|
417
|
-
textBox2.Focus();
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
// button3 を [承諾] ボタンに設定する
|
422
|
-
|
423
|
-
this.AcceptButton = this.button3;
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
//ピクチャーボックスをクリア
|
428
|
-
|
429
|
-
var g = pictureBox2.CreateGraphics();
|
430
|
-
|
431
|
-
g.Clear(Color.WhiteSmoke);
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
//太線の宣言
|
436
|
-
|
437
|
-
var bold = new Pen(Color.Black, 2);
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
//本体フレーム(下)を表示
|
442
|
-
|
443
|
-
var points2 = new Point[5];
|
444
|
-
|
445
|
-
points2[0] = new Point(x, (y + 200));
|
446
|
-
|
447
|
-
points2[1] = new Point((x + 50), (y + 200));
|
448
|
-
|
449
|
-
points2[2] = new Point((x + 50), (y + 150));
|
450
|
-
|
451
|
-
points2[3] = new Point((x + 75), (y + 150));
|
452
|
-
|
453
|
-
points2[4] = new Point((x + 75), (y + 175));
|
454
|
-
|
455
|
-
g.DrawLines(bold, points2);
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
//扉表示
|
460
|
-
|
461
|
-
var points3 = new Point[3];
|
462
|
-
|
463
|
-
points3[0] = new Point((x + 85), (y + 50));
|
464
|
-
|
465
|
-
points3[1] = new Point((x + 85), (y + 190));
|
466
|
-
|
467
|
-
points3[2] = new Point((x + 60), (y + 190));
|
468
|
-
|
469
|
-
g.DrawLines(bold, points3);
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
//縦線の寸法線を表示
|
474
|
-
|
475
|
-
g.DrawLine(Pens.Blue, (x + 95), (y + 190), (x + 140), (y + 190));
|
476
|
-
|
477
|
-
g.DrawLine(Pens.Blue, (x + 130), (y + 190), (x + 130), (y + 200));
|
478
|
-
|
479
|
-
g.DrawLine(Pens.Blue, (x + 95), (y + 200), (x + 140), (y + 200));
|
480
|
-
|
481
|
-
}
|
482
|
-
|
483
|
-
}
|
484
|
-
|
485
|
-
}
|
486
|
-
|
487
|
-
}
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
```
|
492
|
-
|
493
|
-
|
494
|
-
|
495
495
|
//作業しながらでしたので追加のコードがあります。
|
496
496
|
|
497
497
|
//原因が分からず発見したのも完成後でしたので全文載せさせていただきまいした。
|
4
再度修正いたしました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -22,6 +22,10 @@
|
|
22
22
|
|
23
23
|
|
24
24
|
|
25
|
+
```ここに言語を入力
|
26
|
+
|
27
|
+
コード
|
28
|
+
|
25
29
|
```
|
26
30
|
|
27
31
|
|
3
再度修正させていただきました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -20,20 +20,158 @@
|
|
20
20
|
|
21
21
|
エンターキー操作でもクリック操作と同じ結果を得るにはどうすればよろしいのでしょうか?
|
22
22
|
|
23
|
+
|
24
|
+
|
23
25
|
```
|
24
26
|
|
25
27
|
|
26
28
|
|
27
29
|
### 該当のソースコード
|
28
30
|
|
29
|
-
|
31
|
+
using System;
|
32
|
+
|
30
|
-
|
33
|
+
using System.Collections.Generic;
|
34
|
+
|
35
|
+
using System.ComponentModel;
|
36
|
+
|
37
|
+
using System.Data;
|
38
|
+
|
39
|
+
using System.Drawing;
|
40
|
+
|
41
|
+
using System.Linq;
|
42
|
+
|
43
|
+
using System.Text;
|
44
|
+
|
45
|
+
using System.Threading.Tasks;
|
46
|
+
|
47
|
+
using System.Windows.Forms;
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
namespace BoxMaterialApp
|
52
|
+
|
53
|
+
{
|
54
|
+
|
55
|
+
public partial class Form5 : Form
|
56
|
+
|
57
|
+
{
|
58
|
+
|
59
|
+
//x軸,y軸の始点の決定
|
60
|
+
|
61
|
+
int x = 100;
|
62
|
+
|
31
|
-
|
63
|
+
int y = 20;
|
64
|
+
|
65
|
+
|
66
|
+
|
32
|
-
|
67
|
+
//ボックスの高さ、テキストボックス1
|
68
|
+
|
69
|
+
private double box_h = 0;
|
70
|
+
|
71
|
+
//ボックスと扉の下面の隙間、テキストボックス2
|
72
|
+
|
33
|
-
private b
|
73
|
+
private double gap = 0;
|
74
|
+
|
75
|
+
//扉の高さ、テキストボックス3
|
76
|
+
|
77
|
+
private double door_h = 0;
|
78
|
+
|
79
|
+
//扉下面からハンドル上面までの高さ、テキストボックス4
|
80
|
+
|
81
|
+
private double handle_h = 0;
|
82
|
+
|
83
|
+
//上面ガーター部の曲げの値、テキストボックス5
|
84
|
+
|
85
|
+
private double garter_over = 0;
|
86
|
+
|
87
|
+
//下面ガーター部の曲げの値、テキストボックス6
|
88
|
+
|
89
|
+
private double garter_under = 0;
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
public Form5()
|
34
94
|
|
35
95
|
{
|
36
96
|
|
97
|
+
InitializeComponent();
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
//ピクチャーボックスをクリア
|
102
|
+
|
103
|
+
var g = pictureBox2.CreateGraphics();
|
104
|
+
|
105
|
+
g.Clear(Color.WhiteSmoke);
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
//ボタンを隠す
|
110
|
+
|
111
|
+
button2.Visible = false;
|
112
|
+
|
113
|
+
label1.Visible = false;
|
114
|
+
|
115
|
+
textBox1.Visible = false;
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
button3.Visible = false;
|
120
|
+
|
121
|
+
label2.Visible = false;
|
122
|
+
|
123
|
+
textBox2.Visible = false;
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
button4.Visible = false;
|
128
|
+
|
129
|
+
label3.Visible = false;
|
130
|
+
|
131
|
+
textBox3.Visible = false;
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
button5.Visible = false;
|
136
|
+
|
137
|
+
label4.Visible = false;
|
138
|
+
|
139
|
+
textBox4.Visible = false;
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
button6.Visible = false;
|
144
|
+
|
145
|
+
label5.Visible = false;
|
146
|
+
|
147
|
+
textBox5.Visible = false;
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
button7.Visible = false;
|
152
|
+
|
153
|
+
label6.Visible = false;
|
154
|
+
|
155
|
+
textBox6.Visible = false;
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
button8.Visible = false;
|
160
|
+
|
161
|
+
comboBox1.Visible = false;
|
162
|
+
|
163
|
+
label7.Visible = false;
|
164
|
+
|
165
|
+
label8.Visible = false;
|
166
|
+
|
167
|
+
}
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
private bool checkValue()
|
172
|
+
|
173
|
+
{
|
174
|
+
|
37
175
|
//テキストボックスの値をdouble型に変換してフィールドに格納
|
38
176
|
|
39
177
|
//成功すればtrueを返す
|
@@ -78,580 +216,278 @@
|
|
78
216
|
|
79
217
|
}
|
80
218
|
|
219
|
+
|
220
|
+
|
221
|
+
private bool checkValue2()
|
222
|
+
|
223
|
+
{
|
224
|
+
|
225
|
+
//テキストボックスの値をdouble型に変換してフィールドに格納
|
226
|
+
|
227
|
+
//成功すればtrueを返す
|
228
|
+
|
229
|
+
try
|
230
|
+
|
231
|
+
{
|
232
|
+
|
233
|
+
gap = Convert.ToDouble(textBox2.Text);
|
234
|
+
|
235
|
+
return true;
|
236
|
+
|
237
|
+
}
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
//int型に変換できないときはメッセージを送信
|
242
|
+
|
243
|
+
//falseを返す
|
244
|
+
|
245
|
+
catch
|
246
|
+
|
247
|
+
{
|
248
|
+
|
249
|
+
MessageBox.Show("半角数字で入力してください。", "エラー");
|
250
|
+
|
251
|
+
return false;
|
252
|
+
|
253
|
+
}
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
//テキストボックスをクリアする。
|
258
|
+
|
259
|
+
finally
|
260
|
+
|
261
|
+
{
|
262
|
+
|
263
|
+
textBox2.Clear();
|
264
|
+
|
265
|
+
}
|
266
|
+
|
267
|
+
}
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
private void button1_Click(object sender, EventArgs e)
|
274
|
+
|
275
|
+
{
|
276
|
+
|
277
|
+
//ボタンを隠す
|
278
|
+
|
279
|
+
button1.Visible = false;
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
//ボタンの表示
|
284
|
+
|
285
|
+
button2.Visible = true;
|
286
|
+
|
287
|
+
label1.Visible = true;
|
288
|
+
|
289
|
+
textBox1.Visible = true;
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
//カーソルのフォーカス
|
294
|
+
|
295
|
+
textBox1.Focus();
|
296
|
+
|
297
|
+
// button2 を [承諾] ボタンに設定する
|
298
|
+
|
299
|
+
this.AcceptButton = this.button2;
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
//ピクチャーボックスの宣言
|
304
|
+
|
305
|
+
var g = pictureBox2.CreateGraphics();
|
306
|
+
|
307
|
+
g.Clear(Color.WhiteSmoke);
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
//太線の宣言
|
312
|
+
|
313
|
+
var bold = new Pen(Color.Black, 2);
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
//本体フレーム(上)を表示
|
318
|
+
|
319
|
+
var points1 = new Point[5];
|
320
|
+
|
321
|
+
points1[0] = new Point(x, y);
|
322
|
+
|
323
|
+
points1[1] = new Point((x + 50), y);
|
324
|
+
|
325
|
+
points1[2] = new Point((x + 50), (y + 50));
|
326
|
+
|
327
|
+
points1[3] = new Point((x + 75), (y + 50));
|
328
|
+
|
329
|
+
points1[4] = new Point((x + 75), (y + 25));
|
330
|
+
|
331
|
+
g.DrawLines(bold, points1);
|
332
|
+
|
333
|
+
|
334
|
+
|
335
|
+
//本体フレーム(下)を表示
|
336
|
+
|
337
|
+
var points2 = new Point[5];
|
338
|
+
|
339
|
+
points2[0] = new Point(x, (y + 300));
|
340
|
+
|
341
|
+
points2[1] = new Point((x + 50), (y + 300));
|
342
|
+
|
343
|
+
points2[2] = new Point((x + 50), (y + 250));
|
344
|
+
|
345
|
+
points2[3] = new Point((x + 75), (y + 250));
|
346
|
+
|
347
|
+
points2[4] = new Point((x + 75), (y + 275));
|
348
|
+
|
349
|
+
g.DrawLines(bold, points2);
|
350
|
+
|
351
|
+
|
352
|
+
|
353
|
+
//扉表示
|
354
|
+
|
355
|
+
var points3 = new Point[4];
|
356
|
+
|
357
|
+
points3[0] = new Point((x + 60), (y + 10));
|
358
|
+
|
359
|
+
points3[1] = new Point((x + 85), (y + 10));
|
360
|
+
|
361
|
+
points3[2] = new Point((x + 85), (y + 290));
|
362
|
+
|
363
|
+
points3[3] = new Point((x + 60), (y + 290));
|
364
|
+
|
365
|
+
g.DrawLines(bold, points3);
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
//縦線の寸法線を表示
|
370
|
+
|
371
|
+
g.DrawLine(Pens.Blue, (x + 95), y, (x + 140), y);
|
372
|
+
|
373
|
+
g.DrawLine(Pens.Blue, (x + 130), y, (x + 130), (y + 300));
|
374
|
+
|
375
|
+
g.DrawLine(Pens.Blue, (x + 95), (y + 300), (x + 140), (y + 300));
|
376
|
+
|
377
|
+
|
378
|
+
|
379
|
+
}
|
380
|
+
|
381
|
+
|
382
|
+
|
383
|
+
private void button2_Click(object sender, EventArgs e)
|
384
|
+
|
385
|
+
{
|
386
|
+
|
387
|
+
if (checkValue())
|
388
|
+
|
389
|
+
{
|
390
|
+
|
391
|
+
//ボタンを隠す
|
392
|
+
|
393
|
+
button2.Visible = false;
|
394
|
+
|
395
|
+
label1.Visible = false;
|
396
|
+
|
397
|
+
textBox1.Visible = false;
|
398
|
+
|
399
|
+
|
400
|
+
|
401
|
+
//ボタンの表示
|
402
|
+
|
403
|
+
button3.Visible = true;
|
404
|
+
|
405
|
+
label2.Visible = true;
|
406
|
+
|
407
|
+
textBox2.Visible = true;
|
408
|
+
|
409
|
+
|
410
|
+
|
411
|
+
//カーソルのフォーカス
|
412
|
+
|
413
|
+
textBox2.Focus();
|
414
|
+
|
415
|
+
|
416
|
+
|
417
|
+
// button3 を [承諾] ボタンに設定する
|
418
|
+
|
419
|
+
this.AcceptButton = this.button3;
|
420
|
+
|
421
|
+
|
422
|
+
|
423
|
+
//ピクチャーボックスをクリア
|
424
|
+
|
425
|
+
var g = pictureBox2.CreateGraphics();
|
426
|
+
|
427
|
+
g.Clear(Color.WhiteSmoke);
|
428
|
+
|
429
|
+
|
430
|
+
|
431
|
+
//太線の宣言
|
432
|
+
|
433
|
+
var bold = new Pen(Color.Black, 2);
|
434
|
+
|
435
|
+
|
436
|
+
|
437
|
+
//本体フレーム(下)を表示
|
438
|
+
|
439
|
+
var points2 = new Point[5];
|
440
|
+
|
441
|
+
points2[0] = new Point(x, (y + 200));
|
442
|
+
|
443
|
+
points2[1] = new Point((x + 50), (y + 200));
|
444
|
+
|
445
|
+
points2[2] = new Point((x + 50), (y + 150));
|
446
|
+
|
447
|
+
points2[3] = new Point((x + 75), (y + 150));
|
448
|
+
|
449
|
+
points2[4] = new Point((x + 75), (y + 175));
|
450
|
+
|
451
|
+
g.DrawLines(bold, points2);
|
452
|
+
|
453
|
+
|
454
|
+
|
455
|
+
//扉表示
|
456
|
+
|
457
|
+
var points3 = new Point[3];
|
458
|
+
|
459
|
+
points3[0] = new Point((x + 85), (y + 50));
|
460
|
+
|
461
|
+
points3[1] = new Point((x + 85), (y + 190));
|
462
|
+
|
463
|
+
points3[2] = new Point((x + 60), (y + 190));
|
464
|
+
|
465
|
+
g.DrawLines(bold, points3);
|
466
|
+
|
467
|
+
|
468
|
+
|
469
|
+
//縦線の寸法線を表示
|
470
|
+
|
471
|
+
g.DrawLine(Pens.Blue, (x + 95), (y + 190), (x + 140), (y + 190));
|
472
|
+
|
473
|
+
g.DrawLine(Pens.Blue, (x + 130), (y + 190), (x + 130), (y + 200));
|
474
|
+
|
475
|
+
g.DrawLine(Pens.Blue, (x + 95), (y + 200), (x + 140), (y + 200));
|
476
|
+
|
477
|
+
}
|
478
|
+
|
479
|
+
}
|
480
|
+
|
481
|
+
}
|
482
|
+
|
483
|
+
}
|
484
|
+
|
485
|
+
|
486
|
+
|
81
487
|
```
|
82
488
|
|
83
489
|
|
84
490
|
|
85
|
-
private void button1_Click(object sender, EventArgs e)
|
86
|
-
|
87
|
-
{
|
88
|
-
|
89
|
-
//ボタンを隠す
|
90
|
-
|
91
|
-
button1.Visible = false;
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
//ボタンの表示
|
96
|
-
|
97
|
-
button2.Visible = true;
|
98
|
-
|
99
|
-
label1.Visible = true;
|
100
|
-
|
101
|
-
textBox1.Visible = true;
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
//カーソルのフォーカス
|
106
|
-
|
107
|
-
textBox1.Focus();
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
//ピクチャーボックスの宣言
|
112
|
-
|
113
|
-
var g = pictureBox2.CreateGraphics();
|
114
|
-
|
115
|
-
g.Clear(Color.WhiteSmoke);
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
//太線の宣言
|
120
|
-
|
121
|
-
var bold = new Pen(Color.Black, 2);
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
//本体フレーム(上)を表示
|
126
|
-
|
127
|
-
var points1 = new Point[5];
|
128
|
-
|
129
|
-
points1[0] = new Point(x, y);
|
130
|
-
|
131
|
-
points1[1] = new Point((x + 50), y);
|
132
|
-
|
133
|
-
points1[2] = new Point((x + 50), (y + 50));
|
134
|
-
|
135
|
-
points1[3] = new Point((x + 75), (y + 50));
|
136
|
-
|
137
|
-
points1[4] = new Point((x + 75), (y + 25));
|
138
|
-
|
139
|
-
g.DrawLines(bold, points1);
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
//本体フレーム(下)を表示
|
144
|
-
|
145
|
-
var points2 = new Point[5];
|
146
|
-
|
147
|
-
points2[0] = new Point(x, (y + 300));
|
148
|
-
|
149
|
-
points2[1] = new Point((x + 50), (y + 300));
|
150
|
-
|
151
|
-
points2[2] = new Point((x + 50), (y + 250));
|
152
|
-
|
153
|
-
points2[3] = new Point((x + 75), (y + 250));
|
154
|
-
|
155
|
-
points2[4] = new Point((x + 75), (y + 275));
|
156
|
-
|
157
|
-
g.DrawLines(bold, points2);
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
//扉表示
|
162
|
-
|
163
|
-
var points3 = new Point[4];
|
164
|
-
|
165
|
-
points3[0] = new Point((x + 60), (y + 10));
|
166
|
-
|
167
|
-
points3[1] = new Point((x + 85), (y + 10));
|
168
|
-
|
169
|
-
points3[2] = new Point((x + 85), (y + 290));
|
170
|
-
|
171
|
-
points3[3] = new Point((x + 60), (y + 290));
|
172
|
-
|
173
|
-
g.DrawLines(bold, points3);
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
//縦線の寸法線を表示
|
178
|
-
|
179
|
-
g.DrawLine(Pens.Blue, (x + 95), y, (x + 140), y);
|
180
|
-
|
181
|
-
g.DrawLine(Pens.Blue, (x + 130), y, (x + 130), (y + 300));
|
182
|
-
|
183
|
-
g.DrawLine(Pens.Blue, (x + 95), (y + 300), (x + 140), (y + 300));
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
}
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
\ここから追記させていただきました。
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
```visual C#
|
196
|
-
|
197
|
-
using System;
|
198
|
-
|
199
|
-
using System.Collections.Generic;
|
200
|
-
|
201
|
-
using System.ComponentModel;
|
202
|
-
|
203
|
-
using System.Data;
|
204
|
-
|
205
|
-
using System.Drawing;
|
206
|
-
|
207
|
-
using System.Linq;
|
208
|
-
|
209
|
-
using System.Text;
|
210
|
-
|
211
|
-
using System.Threading.Tasks;
|
212
|
-
|
213
|
-
using System.Windows.Forms;
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
namespace BoxMaterialApp
|
218
|
-
|
219
|
-
{
|
220
|
-
|
221
|
-
public partial class Form5 : Form
|
222
|
-
|
223
|
-
{
|
224
|
-
|
225
|
-
//x軸,y軸の始点の決定
|
226
|
-
|
227
|
-
int x = 100;
|
228
|
-
|
229
|
-
int y = 20;
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
//ボックスの高さ、テキストボックス1
|
234
|
-
|
235
|
-
private double box_h = 0;
|
236
|
-
|
237
|
-
//ボックスと扉の下面の隙間、テキストボックス2
|
238
|
-
|
239
|
-
private double gap = 0;
|
240
|
-
|
241
|
-
//扉の高さ、テキストボックス3
|
242
|
-
|
243
|
-
private double door_h = 0;
|
244
|
-
|
245
|
-
//扉下面からハンドル上面までの高さ、テキストボックス4
|
246
|
-
|
247
|
-
private double handle_h = 0;
|
248
|
-
|
249
|
-
//上面ガーター部の曲げの値、テキストボックス5
|
250
|
-
|
251
|
-
private double garter_over = 0;
|
252
|
-
|
253
|
-
//下面ガーター部の曲げの値、テキストボックス6
|
254
|
-
|
255
|
-
private double garter_under = 0;
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
public Form5()
|
260
|
-
|
261
|
-
{
|
262
|
-
|
263
|
-
InitializeComponent();
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
//ピクチャーボックスをクリア
|
268
|
-
|
269
|
-
var g = pictureBox2.CreateGraphics();
|
270
|
-
|
271
|
-
g.Clear(Color.WhiteSmoke);
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
//ボタンを隠す
|
276
|
-
|
277
|
-
button2.Visible = false;
|
278
|
-
|
279
|
-
label1.Visible = false;
|
280
|
-
|
281
|
-
textBox1.Visible = false;
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
button3.Visible = false;
|
286
|
-
|
287
|
-
label2.Visible = false;
|
288
|
-
|
289
|
-
textBox2.Visible = false;
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
button4.Visible = false;
|
294
|
-
|
295
|
-
label3.Visible = false;
|
296
|
-
|
297
|
-
textBox3.Visible = false;
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
button5.Visible = false;
|
302
|
-
|
303
|
-
label4.Visible = false;
|
304
|
-
|
305
|
-
textBox4.Visible = false;
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
button6.Visible = false;
|
310
|
-
|
311
|
-
label5.Visible = false;
|
312
|
-
|
313
|
-
textBox5.Visible = false;
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
button7.Visible = false;
|
318
|
-
|
319
|
-
label6.Visible = false;
|
320
|
-
|
321
|
-
textBox6.Visible = false;
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
button8.Visible = false;
|
326
|
-
|
327
|
-
comboBox1.Visible = false;
|
328
|
-
|
329
|
-
label7.Visible = false;
|
330
|
-
|
331
|
-
label8.Visible = false;
|
332
|
-
|
333
|
-
}
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
private bool checkValue()
|
338
|
-
|
339
|
-
{
|
340
|
-
|
341
|
-
//テキストボックスの値をdouble型に変換してフィールドに格納
|
342
|
-
|
343
|
-
//成功すればtrueを返す
|
344
|
-
|
345
|
-
try
|
346
|
-
|
347
|
-
{
|
348
|
-
|
349
|
-
box_h = Convert.ToDouble(textBox1.Text);
|
350
|
-
|
351
|
-
return true;
|
352
|
-
|
353
|
-
}
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
//int型に変換できないときはメッセージを送信
|
358
|
-
|
359
|
-
//falseを返す
|
360
|
-
|
361
|
-
catch
|
362
|
-
|
363
|
-
{
|
364
|
-
|
365
|
-
MessageBox.Show("半角数字で入力してください。", "エラー");
|
366
|
-
|
367
|
-
return false;
|
368
|
-
|
369
|
-
}
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
//テキストボックスをクリアする。
|
374
|
-
|
375
|
-
finally
|
376
|
-
|
377
|
-
{
|
378
|
-
|
379
|
-
textBox1.Clear();
|
380
|
-
|
381
|
-
}
|
382
|
-
|
383
|
-
}
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
private bool checkValue2()
|
388
|
-
|
389
|
-
{
|
390
|
-
|
391
|
-
//テキストボックスの値をdouble型に変換してフィールドに格納
|
392
|
-
|
393
|
-
//成功すればtrueを返す
|
394
|
-
|
395
|
-
try
|
396
|
-
|
397
|
-
{
|
398
|
-
|
399
|
-
gap = Convert.ToDouble(textBox2.Text);
|
400
|
-
|
401
|
-
return true;
|
402
|
-
|
403
|
-
}
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
//int型に変換できないときはメッセージを送信
|
408
|
-
|
409
|
-
//falseを返す
|
410
|
-
|
411
|
-
catch
|
412
|
-
|
413
|
-
{
|
414
|
-
|
415
|
-
MessageBox.Show("半角数字で入力してください。", "エラー");
|
416
|
-
|
417
|
-
return false;
|
418
|
-
|
419
|
-
}
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
//テキストボックスをクリアする。
|
424
|
-
|
425
|
-
finally
|
426
|
-
|
427
|
-
{
|
428
|
-
|
429
|
-
textBox2.Clear();
|
430
|
-
|
431
|
-
}
|
432
|
-
|
433
|
-
}
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
private void button1_Click(object sender, EventArgs e)
|
440
|
-
|
441
|
-
{
|
442
|
-
|
443
|
-
//ボタンを隠す
|
444
|
-
|
445
|
-
button1.Visible = false;
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
//ボタンの表示
|
450
|
-
|
451
|
-
button2.Visible = true;
|
452
|
-
|
453
|
-
label1.Visible = true;
|
454
|
-
|
455
|
-
textBox1.Visible = true;
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
//カーソルのフォーカス
|
460
|
-
|
461
|
-
textBox1.Focus();
|
462
|
-
|
463
|
-
// button2 を [承諾] ボタンに設定する
|
464
|
-
|
465
|
-
this.AcceptButton = this.button2;
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
//ピクチャーボックスの宣言
|
470
|
-
|
471
|
-
var g = pictureBox2.CreateGraphics();
|
472
|
-
|
473
|
-
g.Clear(Color.WhiteSmoke);
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
//太線の宣言
|
478
|
-
|
479
|
-
var bold = new Pen(Color.Black, 2);
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
//本体フレーム(上)を表示
|
484
|
-
|
485
|
-
var points1 = new Point[5];
|
486
|
-
|
487
|
-
points1[0] = new Point(x, y);
|
488
|
-
|
489
|
-
points1[1] = new Point((x + 50), y);
|
490
|
-
|
491
|
-
points1[2] = new Point((x + 50), (y + 50));
|
492
|
-
|
493
|
-
points1[3] = new Point((x + 75), (y + 50));
|
494
|
-
|
495
|
-
points1[4] = new Point((x + 75), (y + 25));
|
496
|
-
|
497
|
-
g.DrawLines(bold, points1);
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
//本体フレーム(下)を表示
|
502
|
-
|
503
|
-
var points2 = new Point[5];
|
504
|
-
|
505
|
-
points2[0] = new Point(x, (y + 300));
|
506
|
-
|
507
|
-
points2[1] = new Point((x + 50), (y + 300));
|
508
|
-
|
509
|
-
points2[2] = new Point((x + 50), (y + 250));
|
510
|
-
|
511
|
-
points2[3] = new Point((x + 75), (y + 250));
|
512
|
-
|
513
|
-
points2[4] = new Point((x + 75), (y + 275));
|
514
|
-
|
515
|
-
g.DrawLines(bold, points2);
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
//扉表示
|
520
|
-
|
521
|
-
var points3 = new Point[4];
|
522
|
-
|
523
|
-
points3[0] = new Point((x + 60), (y + 10));
|
524
|
-
|
525
|
-
points3[1] = new Point((x + 85), (y + 10));
|
526
|
-
|
527
|
-
points3[2] = new Point((x + 85), (y + 290));
|
528
|
-
|
529
|
-
points3[3] = new Point((x + 60), (y + 290));
|
530
|
-
|
531
|
-
g.DrawLines(bold, points3);
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
//縦線の寸法線を表示
|
536
|
-
|
537
|
-
g.DrawLine(Pens.Blue, (x + 95), y, (x + 140), y);
|
538
|
-
|
539
|
-
g.DrawLine(Pens.Blue, (x + 130), y, (x + 130), (y + 300));
|
540
|
-
|
541
|
-
g.DrawLine(Pens.Blue, (x + 95), (y + 300), (x + 140), (y + 300));
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
}
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
private void button2_Click(object sender, EventArgs e)
|
550
|
-
|
551
|
-
{
|
552
|
-
|
553
|
-
if (checkValue())
|
554
|
-
|
555
|
-
{
|
556
|
-
|
557
|
-
//ボタンを隠す
|
558
|
-
|
559
|
-
button2.Visible = false;
|
560
|
-
|
561
|
-
label1.Visible = false;
|
562
|
-
|
563
|
-
textBox1.Visible = false;
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
//ボタンの表示
|
568
|
-
|
569
|
-
button3.Visible = true;
|
570
|
-
|
571
|
-
label2.Visible = true;
|
572
|
-
|
573
|
-
textBox2.Visible = true;
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
//カーソルのフォーカス
|
578
|
-
|
579
|
-
textBox2.Focus();
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
// button3 を [承諾] ボタンに設定する
|
584
|
-
|
585
|
-
this.AcceptButton = this.button3;
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
//ピクチャーボックスをクリア
|
590
|
-
|
591
|
-
var g = pictureBox2.CreateGraphics();
|
592
|
-
|
593
|
-
g.Clear(Color.WhiteSmoke);
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
//太線の宣言
|
598
|
-
|
599
|
-
var bold = new Pen(Color.Black, 2);
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
//本体フレーム(下)を表示
|
604
|
-
|
605
|
-
var points2 = new Point[5];
|
606
|
-
|
607
|
-
points2[0] = new Point(x, (y + 200));
|
608
|
-
|
609
|
-
points2[1] = new Point((x + 50), (y + 200));
|
610
|
-
|
611
|
-
points2[2] = new Point((x + 50), (y + 150));
|
612
|
-
|
613
|
-
points2[3] = new Point((x + 75), (y + 150));
|
614
|
-
|
615
|
-
points2[4] = new Point((x + 75), (y + 175));
|
616
|
-
|
617
|
-
g.DrawLines(bold, points2);
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
//扉表示
|
622
|
-
|
623
|
-
var points3 = new Point[3];
|
624
|
-
|
625
|
-
points3[0] = new Point((x + 85), (y + 50));
|
626
|
-
|
627
|
-
points3[1] = new Point((x + 85), (y + 190));
|
628
|
-
|
629
|
-
points3[2] = new Point((x + 60), (y + 190));
|
630
|
-
|
631
|
-
g.DrawLines(bold, points3);
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
//縦線の寸法線を表示
|
636
|
-
|
637
|
-
g.DrawLine(Pens.Blue, (x + 95), (y + 190), (x + 140), (y + 190));
|
638
|
-
|
639
|
-
g.DrawLine(Pens.Blue, (x + 130), (y + 190), (x + 130), (y + 200));
|
640
|
-
|
641
|
-
g.DrawLine(Pens.Blue, (x + 95), (y + 200), (x + 140), (y + 200));
|
642
|
-
|
643
|
-
}
|
644
|
-
|
645
|
-
}
|
646
|
-
|
647
|
-
}
|
648
|
-
|
649
|
-
}
|
650
|
-
|
651
|
-
```
|
652
|
-
|
653
|
-
|
654
|
-
|
655
491
|
//作業しながらでしたので追加のコードがあります。
|
656
492
|
|
657
493
|
//原因が分からず発見したのも完成後でしたので全文載せさせていただきまいした。
|
2
再度修正させていただきました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -190,11 +190,11 @@
|
|
190
190
|
|
191
191
|
\ここから追記させていただきました。
|
192
192
|
|
193
|
+
|
194
|
+
|
193
|
-
visual C#
|
195
|
+
```visual C#
|
194
|
-
|
195
|
-
|
196
|
-
|
196
|
+
|
197
|
-
|
197
|
+
using System;
|
198
198
|
|
199
199
|
using System.Collections.Generic;
|
200
200
|
|
@@ -648,6 +648,8 @@
|
|
648
648
|
|
649
649
|
}
|
650
650
|
|
651
|
+
```
|
652
|
+
|
651
653
|
|
652
654
|
|
653
655
|
//作業しながらでしたので追加のコードがあります。
|
1
追記させていただきました。初めての質問投稿で無作法があるとおもいますがよろしくお願いします。
test
CHANGED
File without changes
|
test
CHANGED
@@ -188,6 +188,476 @@
|
|
188
188
|
|
189
189
|
|
190
190
|
|
191
|
+
\ここから追記させていただきました。
|
192
|
+
|
193
|
+
visual C#
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
```using System;
|
198
|
+
|
199
|
+
using System.Collections.Generic;
|
200
|
+
|
201
|
+
using System.ComponentModel;
|
202
|
+
|
203
|
+
using System.Data;
|
204
|
+
|
205
|
+
using System.Drawing;
|
206
|
+
|
207
|
+
using System.Linq;
|
208
|
+
|
209
|
+
using System.Text;
|
210
|
+
|
211
|
+
using System.Threading.Tasks;
|
212
|
+
|
213
|
+
using System.Windows.Forms;
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
namespace BoxMaterialApp
|
218
|
+
|
219
|
+
{
|
220
|
+
|
221
|
+
public partial class Form5 : Form
|
222
|
+
|
223
|
+
{
|
224
|
+
|
225
|
+
//x軸,y軸の始点の決定
|
226
|
+
|
227
|
+
int x = 100;
|
228
|
+
|
229
|
+
int y = 20;
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
//ボックスの高さ、テキストボックス1
|
234
|
+
|
235
|
+
private double box_h = 0;
|
236
|
+
|
237
|
+
//ボックスと扉の下面の隙間、テキストボックス2
|
238
|
+
|
239
|
+
private double gap = 0;
|
240
|
+
|
241
|
+
//扉の高さ、テキストボックス3
|
242
|
+
|
243
|
+
private double door_h = 0;
|
244
|
+
|
245
|
+
//扉下面からハンドル上面までの高さ、テキストボックス4
|
246
|
+
|
247
|
+
private double handle_h = 0;
|
248
|
+
|
249
|
+
//上面ガーター部の曲げの値、テキストボックス5
|
250
|
+
|
251
|
+
private double garter_over = 0;
|
252
|
+
|
253
|
+
//下面ガーター部の曲げの値、テキストボックス6
|
254
|
+
|
255
|
+
private double garter_under = 0;
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
public Form5()
|
260
|
+
|
261
|
+
{
|
262
|
+
|
263
|
+
InitializeComponent();
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
//ピクチャーボックスをクリア
|
268
|
+
|
269
|
+
var g = pictureBox2.CreateGraphics();
|
270
|
+
|
271
|
+
g.Clear(Color.WhiteSmoke);
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
//ボタンを隠す
|
276
|
+
|
277
|
+
button2.Visible = false;
|
278
|
+
|
279
|
+
label1.Visible = false;
|
280
|
+
|
281
|
+
textBox1.Visible = false;
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
button3.Visible = false;
|
286
|
+
|
287
|
+
label2.Visible = false;
|
288
|
+
|
289
|
+
textBox2.Visible = false;
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
button4.Visible = false;
|
294
|
+
|
295
|
+
label3.Visible = false;
|
296
|
+
|
297
|
+
textBox3.Visible = false;
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
button5.Visible = false;
|
302
|
+
|
303
|
+
label4.Visible = false;
|
304
|
+
|
305
|
+
textBox4.Visible = false;
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
button6.Visible = false;
|
310
|
+
|
311
|
+
label5.Visible = false;
|
312
|
+
|
313
|
+
textBox5.Visible = false;
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
button7.Visible = false;
|
318
|
+
|
319
|
+
label6.Visible = false;
|
320
|
+
|
321
|
+
textBox6.Visible = false;
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
button8.Visible = false;
|
326
|
+
|
327
|
+
comboBox1.Visible = false;
|
328
|
+
|
329
|
+
label7.Visible = false;
|
330
|
+
|
331
|
+
label8.Visible = false;
|
332
|
+
|
333
|
+
}
|
334
|
+
|
335
|
+
|
336
|
+
|
337
|
+
private bool checkValue()
|
338
|
+
|
339
|
+
{
|
340
|
+
|
341
|
+
//テキストボックスの値をdouble型に変換してフィールドに格納
|
342
|
+
|
343
|
+
//成功すればtrueを返す
|
344
|
+
|
345
|
+
try
|
346
|
+
|
347
|
+
{
|
348
|
+
|
349
|
+
box_h = Convert.ToDouble(textBox1.Text);
|
350
|
+
|
351
|
+
return true;
|
352
|
+
|
353
|
+
}
|
354
|
+
|
355
|
+
|
356
|
+
|
357
|
+
//int型に変換できないときはメッセージを送信
|
358
|
+
|
359
|
+
//falseを返す
|
360
|
+
|
361
|
+
catch
|
362
|
+
|
363
|
+
{
|
364
|
+
|
365
|
+
MessageBox.Show("半角数字で入力してください。", "エラー");
|
366
|
+
|
367
|
+
return false;
|
368
|
+
|
369
|
+
}
|
370
|
+
|
371
|
+
|
372
|
+
|
373
|
+
//テキストボックスをクリアする。
|
374
|
+
|
375
|
+
finally
|
376
|
+
|
377
|
+
{
|
378
|
+
|
379
|
+
textBox1.Clear();
|
380
|
+
|
381
|
+
}
|
382
|
+
|
383
|
+
}
|
384
|
+
|
385
|
+
|
386
|
+
|
387
|
+
private bool checkValue2()
|
388
|
+
|
389
|
+
{
|
390
|
+
|
391
|
+
//テキストボックスの値をdouble型に変換してフィールドに格納
|
392
|
+
|
393
|
+
//成功すればtrueを返す
|
394
|
+
|
395
|
+
try
|
396
|
+
|
397
|
+
{
|
398
|
+
|
399
|
+
gap = Convert.ToDouble(textBox2.Text);
|
400
|
+
|
401
|
+
return true;
|
402
|
+
|
403
|
+
}
|
404
|
+
|
405
|
+
|
406
|
+
|
407
|
+
//int型に変換できないときはメッセージを送信
|
408
|
+
|
409
|
+
//falseを返す
|
410
|
+
|
411
|
+
catch
|
412
|
+
|
413
|
+
{
|
414
|
+
|
415
|
+
MessageBox.Show("半角数字で入力してください。", "エラー");
|
416
|
+
|
417
|
+
return false;
|
418
|
+
|
419
|
+
}
|
420
|
+
|
421
|
+
|
422
|
+
|
423
|
+
//テキストボックスをクリアする。
|
424
|
+
|
425
|
+
finally
|
426
|
+
|
427
|
+
{
|
428
|
+
|
429
|
+
textBox2.Clear();
|
430
|
+
|
431
|
+
}
|
432
|
+
|
433
|
+
}
|
434
|
+
|
435
|
+
|
436
|
+
|
437
|
+
|
438
|
+
|
439
|
+
private void button1_Click(object sender, EventArgs e)
|
440
|
+
|
441
|
+
{
|
442
|
+
|
443
|
+
//ボタンを隠す
|
444
|
+
|
445
|
+
button1.Visible = false;
|
446
|
+
|
447
|
+
|
448
|
+
|
449
|
+
//ボタンの表示
|
450
|
+
|
451
|
+
button2.Visible = true;
|
452
|
+
|
453
|
+
label1.Visible = true;
|
454
|
+
|
455
|
+
textBox1.Visible = true;
|
456
|
+
|
457
|
+
|
458
|
+
|
459
|
+
//カーソルのフォーカス
|
460
|
+
|
461
|
+
textBox1.Focus();
|
462
|
+
|
463
|
+
// button2 を [承諾] ボタンに設定する
|
464
|
+
|
465
|
+
this.AcceptButton = this.button2;
|
466
|
+
|
467
|
+
|
468
|
+
|
469
|
+
//ピクチャーボックスの宣言
|
470
|
+
|
471
|
+
var g = pictureBox2.CreateGraphics();
|
472
|
+
|
473
|
+
g.Clear(Color.WhiteSmoke);
|
474
|
+
|
475
|
+
|
476
|
+
|
477
|
+
//太線の宣言
|
478
|
+
|
479
|
+
var bold = new Pen(Color.Black, 2);
|
480
|
+
|
481
|
+
|
482
|
+
|
483
|
+
//本体フレーム(上)を表示
|
484
|
+
|
485
|
+
var points1 = new Point[5];
|
486
|
+
|
487
|
+
points1[0] = new Point(x, y);
|
488
|
+
|
489
|
+
points1[1] = new Point((x + 50), y);
|
490
|
+
|
491
|
+
points1[2] = new Point((x + 50), (y + 50));
|
492
|
+
|
493
|
+
points1[3] = new Point((x + 75), (y + 50));
|
494
|
+
|
495
|
+
points1[4] = new Point((x + 75), (y + 25));
|
496
|
+
|
497
|
+
g.DrawLines(bold, points1);
|
498
|
+
|
499
|
+
|
500
|
+
|
501
|
+
//本体フレーム(下)を表示
|
502
|
+
|
503
|
+
var points2 = new Point[5];
|
504
|
+
|
505
|
+
points2[0] = new Point(x, (y + 300));
|
506
|
+
|
507
|
+
points2[1] = new Point((x + 50), (y + 300));
|
508
|
+
|
509
|
+
points2[2] = new Point((x + 50), (y + 250));
|
510
|
+
|
511
|
+
points2[3] = new Point((x + 75), (y + 250));
|
512
|
+
|
513
|
+
points2[4] = new Point((x + 75), (y + 275));
|
514
|
+
|
515
|
+
g.DrawLines(bold, points2);
|
516
|
+
|
517
|
+
|
518
|
+
|
519
|
+
//扉表示
|
520
|
+
|
521
|
+
var points3 = new Point[4];
|
522
|
+
|
523
|
+
points3[0] = new Point((x + 60), (y + 10));
|
524
|
+
|
525
|
+
points3[1] = new Point((x + 85), (y + 10));
|
526
|
+
|
527
|
+
points3[2] = new Point((x + 85), (y + 290));
|
528
|
+
|
529
|
+
points3[3] = new Point((x + 60), (y + 290));
|
530
|
+
|
531
|
+
g.DrawLines(bold, points3);
|
532
|
+
|
533
|
+
|
534
|
+
|
535
|
+
//縦線の寸法線を表示
|
536
|
+
|
537
|
+
g.DrawLine(Pens.Blue, (x + 95), y, (x + 140), y);
|
538
|
+
|
539
|
+
g.DrawLine(Pens.Blue, (x + 130), y, (x + 130), (y + 300));
|
540
|
+
|
541
|
+
g.DrawLine(Pens.Blue, (x + 95), (y + 300), (x + 140), (y + 300));
|
542
|
+
|
543
|
+
|
544
|
+
|
545
|
+
}
|
546
|
+
|
547
|
+
|
548
|
+
|
549
|
+
private void button2_Click(object sender, EventArgs e)
|
550
|
+
|
551
|
+
{
|
552
|
+
|
553
|
+
if (checkValue())
|
554
|
+
|
555
|
+
{
|
556
|
+
|
557
|
+
//ボタンを隠す
|
558
|
+
|
559
|
+
button2.Visible = false;
|
560
|
+
|
561
|
+
label1.Visible = false;
|
562
|
+
|
563
|
+
textBox1.Visible = false;
|
564
|
+
|
565
|
+
|
566
|
+
|
567
|
+
//ボタンの表示
|
568
|
+
|
569
|
+
button3.Visible = true;
|
570
|
+
|
571
|
+
label2.Visible = true;
|
572
|
+
|
573
|
+
textBox2.Visible = true;
|
574
|
+
|
575
|
+
|
576
|
+
|
577
|
+
//カーソルのフォーカス
|
578
|
+
|
579
|
+
textBox2.Focus();
|
580
|
+
|
581
|
+
|
582
|
+
|
583
|
+
// button3 を [承諾] ボタンに設定する
|
584
|
+
|
585
|
+
this.AcceptButton = this.button3;
|
586
|
+
|
587
|
+
|
588
|
+
|
589
|
+
//ピクチャーボックスをクリア
|
590
|
+
|
591
|
+
var g = pictureBox2.CreateGraphics();
|
592
|
+
|
593
|
+
g.Clear(Color.WhiteSmoke);
|
594
|
+
|
595
|
+
|
596
|
+
|
597
|
+
//太線の宣言
|
598
|
+
|
599
|
+
var bold = new Pen(Color.Black, 2);
|
600
|
+
|
601
|
+
|
602
|
+
|
603
|
+
//本体フレーム(下)を表示
|
604
|
+
|
605
|
+
var points2 = new Point[5];
|
606
|
+
|
607
|
+
points2[0] = new Point(x, (y + 200));
|
608
|
+
|
609
|
+
points2[1] = new Point((x + 50), (y + 200));
|
610
|
+
|
611
|
+
points2[2] = new Point((x + 50), (y + 150));
|
612
|
+
|
613
|
+
points2[3] = new Point((x + 75), (y + 150));
|
614
|
+
|
615
|
+
points2[4] = new Point((x + 75), (y + 175));
|
616
|
+
|
617
|
+
g.DrawLines(bold, points2);
|
618
|
+
|
619
|
+
|
620
|
+
|
621
|
+
//扉表示
|
622
|
+
|
623
|
+
var points3 = new Point[3];
|
624
|
+
|
625
|
+
points3[0] = new Point((x + 85), (y + 50));
|
626
|
+
|
627
|
+
points3[1] = new Point((x + 85), (y + 190));
|
628
|
+
|
629
|
+
points3[2] = new Point((x + 60), (y + 190));
|
630
|
+
|
631
|
+
g.DrawLines(bold, points3);
|
632
|
+
|
633
|
+
|
634
|
+
|
635
|
+
//縦線の寸法線を表示
|
636
|
+
|
637
|
+
g.DrawLine(Pens.Blue, (x + 95), (y + 190), (x + 140), (y + 190));
|
638
|
+
|
639
|
+
g.DrawLine(Pens.Blue, (x + 130), (y + 190), (x + 130), (y + 200));
|
640
|
+
|
641
|
+
g.DrawLine(Pens.Blue, (x + 95), (y + 200), (x + 140), (y + 200));
|
642
|
+
|
643
|
+
}
|
644
|
+
|
645
|
+
}
|
646
|
+
|
647
|
+
}
|
648
|
+
|
649
|
+
}
|
650
|
+
|
651
|
+
|
652
|
+
|
653
|
+
//作業しながらでしたので追加のコードがあります。
|
654
|
+
|
655
|
+
//原因が分からず発見したのも完成後でしたので全文載せさせていただきまいした。
|
656
|
+
|
657
|
+
//よろしくおねがいいたします。
|
658
|
+
|
659
|
+
|
660
|
+
|
191
661
|
### 試したこと
|
192
662
|
|
193
663
|
|