Last change
on this file since 615 was 615, checked in by イグトランス (egtra), 16 years ago |
サブクラス化機構(Control.Attach)の整備
|
File size:
1.3 KB
|
Line | |
---|
1 | 'Classes/ActiveBasic/Windows/UI/Form.ab
|
---|
2 |
|
---|
3 | #require <Classes/ActiveBasic/Windows/UI/Control.ab>
|
---|
4 | #require <Classes/ActiveBasic/Windows/UI/Button.ab>
|
---|
5 |
|
---|
6 | Namespace ActiveBasic
|
---|
7 | Namespace Windows
|
---|
8 | Namespace UI
|
---|
9 |
|
---|
10 | /*!
|
---|
11 | @date 2008/07/13
|
---|
12 | @brief トップレベルウィンドウを表すクラス。
|
---|
13 | @author Egtra
|
---|
14 | */
|
---|
15 |
|
---|
16 | Class Form
|
---|
17 | Inherits Control
|
---|
18 | Public
|
---|
19 | Sub Form()
|
---|
20 | AddMessageEvent(WM_COMMAND, AddressOf(OnCommand))
|
---|
21 | AddPaintBackground(AddressOf(OnPaintBackground))
|
---|
22 | End Sub
|
---|
23 |
|
---|
24 | Protected
|
---|
25 | Override Sub GetCreateStruct(ByRef cs As CREATESTRUCT)
|
---|
26 | With cs
|
---|
27 | .style = WS_OVERLAPPEDWINDOW
|
---|
28 | .x = CW_USEDEFAULT
|
---|
29 | .y = CW_USEDEFAULT
|
---|
30 | .cx = CW_USEDEFAULT
|
---|
31 | .cy = CW_USEDEFAULT
|
---|
32 | End With
|
---|
33 | End Sub
|
---|
34 |
|
---|
35 | Sub OnPaintBackground(sender As Object, e As PaintBackgroundArgs)
|
---|
36 | Dim rc = ClientRect
|
---|
37 | FillRect(e.Handle, rc, (COLOR_3DFACE + 1) As HBRUSH)
|
---|
38 | End Sub
|
---|
39 |
|
---|
40 | Sub OnCommand(sender As Object, e As MessageArgs)
|
---|
41 | Dim id = e.WParam And &hffff 'LOWORD(e.WParam)
|
---|
42 | Dim cmd = (e.WParam >> 16) And &hffff 'HIWORD(e.WParam)
|
---|
43 | Dim hwnd = e.LParam As HWND
|
---|
44 | If cmd = BN_CLICKED And hwnd <> 0 Then
|
---|
45 | Dim c = Control.FromHWnd(hwnd)
|
---|
46 | If IsNothing(c) = False Then
|
---|
47 | Dim b = c As Button
|
---|
48 | b.RaiseClick()
|
---|
49 | End If
|
---|
50 | End If
|
---|
51 | End Sub
|
---|
52 |
|
---|
53 | #include "FormEvent.sbp"
|
---|
54 | End Class
|
---|
55 |
|
---|
56 | End Namespace 'UI
|
---|
57 | End Namespace 'Widnows
|
---|
58 | End Namespace 'ActiveBasic
|
---|
Note:
See
TracBrowser
for help on using the repository browser.