回答編集履歴
1
追加
answer
CHANGED
@@ -56,7 +56,43 @@
|
|
56
56
|
```
|
57
57
|
「ウインドウプロシージャ」で、ユーザーの操作内容をすり替えています。
|
58
58
|
|
59
|
-
|
59
|
+
##閉じるボタンを無効にする
|
60
|
+
Alt+F4も無効になる方法と、有効なままにする方法とありますが、ここでは前者を。
|
60
61
|
|
62
|
+
```C#
|
63
|
+
using System;
|
64
|
+
using System.Windows.Forms;
|
65
|
+
using System.Security.Permissions;
|
66
|
+
|
67
|
+
namespace WindowsFormsApplication1
|
68
|
+
{
|
69
|
+
public partial class TargetForm : Form
|
70
|
+
{
|
71
|
+
public TargetForm()
|
72
|
+
{
|
73
|
+
InitializeComponent();
|
74
|
+
}
|
75
|
+
|
76
|
+
// ここから
|
77
|
+
protected override CreateParams CreateParams
|
78
|
+
{
|
79
|
+
[SecurityPermission(SecurityAction.Demand,
|
80
|
+
Flags = SecurityPermissionFlag.UnmanagedCode)]
|
81
|
+
get
|
82
|
+
{
|
83
|
+
CreateParams cp = base.CreateParams;
|
84
|
+
cp.ClassStyle = cp.ClassStyle | 0x200; // CS_NOCLOSE を追加
|
85
|
+
|
86
|
+
return cp;
|
87
|
+
}
|
88
|
+
}
|
89
|
+
// ここまで
|
90
|
+
}
|
91
|
+
}
|
92
|
+
|
93
|
+
```
|
94
|
+
|
95
|
+
|
61
96
|
##ご参考
|
62
|
-
- [フォームのサイズを制限する](http://dobon.net/vb/dotnet/form/minimumsize.html) - DOBON.NETさん
|
97
|
+
- [フォームのサイズを制限する](http://dobon.net/vb/dotnet/form/minimumsize.html) - DOBON.NETさん
|
98
|
+
- [フォームの「閉じる」ボタンを無効にする](http://dobon.net/vb/dotnet/form/disabledclosebutton.html) - DOBON.NETさん
|