1 | Namespace System
|
---|
2 | Namespace Windows
|
---|
3 | Namespace Forms
|
---|
4 |
|
---|
5 |
|
---|
6 | Enum DialogResult
|
---|
7 | None = NULL 'ダイアログ ボックスから Nothing が返されます。つまり、モーダル ダイアログ ボックスの実行が継続します。
|
---|
8 | Abort = IDABORT 'ダイアログ ボックスの戻り値は Abort です (通常は "中止" というラベルが指定されたボタンから送られます)。
|
---|
9 | Cancel = IDCANCEL 'ダイアログ ボックスの戻り値は Cancel です (通常は "キャンセル" というラベルが指定されたボタンから送られます)。
|
---|
10 | Ignore = IDIGNORE 'ダイアログ ボックスの戻り値は Ignore です (通常は "無視" というラベルが指定されたボタンから送られます)。
|
---|
11 | No = IDNO 'ダイアログ ボックスの戻り値は No です (通常は "いいえ" というラベルが指定されたボタンから送られます)。
|
---|
12 | OK = IDOK 'ダイアログ ボックスの戻り値は OK です (通常は "OK" というラベルが指定されたボタンから送られます)。
|
---|
13 | Retry = IDRETRY 'ダイアログ ボックスの戻り値は Retry です (通常は "再試行" というラベルが指定されたボタンから送られます)。
|
---|
14 | Yes = IDYES 'ダイアログ ボックスの戻り値は Yes です (通常は "はい" というラベルが指定されたボタンから送られます)。
|
---|
15 | End Enum
|
---|
16 |
|
---|
17 | Class Form
|
---|
18 | Inherits ContainerControl
|
---|
19 | Public
|
---|
20 |
|
---|
21 | Sub Form()
|
---|
22 | With createParams
|
---|
23 | .Style or= WS_OVERLAPPEDWINDOW or WS_VISIBLE or WS_CLIPSIBLINGS or WS_CLIPCHILDREN
|
---|
24 | .ExStyle or= WS_EX_WINDOWEDGE or WS_EX_CONTROLPARENT or WS_EX_APPWINDOW
|
---|
25 | .Width = 300
|
---|
26 | .Height = 300
|
---|
27 | End With
|
---|
28 | End Sub
|
---|
29 |
|
---|
30 | Function ShowDialog() As DialogResult
|
---|
31 | Dim isParentEnable = False
|
---|
32 | If Not ActiveBasic.IsNothing( This.Parent ) Then
|
---|
33 | ' 親コントロールを無効にする
|
---|
34 | isParentEnable = This.Parent.Enabled
|
---|
35 | This.Parent.Enabled = False
|
---|
36 | End If
|
---|
37 |
|
---|
38 | This.Show()
|
---|
39 |
|
---|
40 | ' メッセージループ
|
---|
41 | Dim msg As MSG, iResult As Long
|
---|
42 | Do
|
---|
43 | iResult=GetMessage(msg,0,0,0)
|
---|
44 | If iResult=0 or iResult=-1 Then Exit Do
|
---|
45 | If IsDialogMessage(This.Handle,msg) Then Continue
|
---|
46 | TranslateMessage(msg)
|
---|
47 | DispatchMessage(msg)
|
---|
48 | Loop
|
---|
49 |
|
---|
50 | If Not ActiveBasic.IsNothing( This.Parent ) Then
|
---|
51 | ' もともと親コントロールが有効だった場合には有効に戻す
|
---|
52 | If isParentEnable Then
|
---|
53 | This.Parent.Enabled = True
|
---|
54 | End If
|
---|
55 | End If
|
---|
56 |
|
---|
57 | Return msg.wParam As DialogResult
|
---|
58 | End Function
|
---|
59 | End Class
|
---|
60 |
|
---|
61 |
|
---|
62 | End Namespace
|
---|
63 | End Namespace
|
---|
64 | End Namespace
|
---|