Rev | Line | |
---|
[547] | 1 | 'Classes/ActiveBasic/Windows/UI/Form.ab
|
---|
| 2 |
|
---|
| 3 | #require <Classes/ActiveBasic/Windows/UI/Control.ab>
|
---|
| 4 |
|
---|
| 5 | Namespace ActiveBasic
|
---|
| 6 | Namespace Windows
|
---|
| 7 | Namespace UI
|
---|
| 8 |
|
---|
| 9 | /*!
|
---|
| 10 | @date 2008/07/13
|
---|
| 11 | @brief トップレベルウィンドウを表すクラス。
|
---|
| 12 | @author Egtra
|
---|
| 13 | */
|
---|
| 14 | Class Form
|
---|
| 15 | Inherits Control
|
---|
| 16 | Protected
|
---|
| 17 | Override Sub GetCreateStruct(ByRef cs As CREATESTRUCT)
|
---|
| 18 | With cs
|
---|
| 19 | .lpCreateParams = 0
|
---|
| 20 | '.hInstance
|
---|
| 21 | .hMenu = 0
|
---|
| 22 | .hwndParent = 0
|
---|
| 23 | .cy = CW_USEDEFAULT
|
---|
| 24 | .cx = CW_USEDEFAULT
|
---|
| 25 | .y = CW_USEDEFAULT
|
---|
| 26 | .x = CW_USEDEFAULT
|
---|
| 27 | .style = WS_OVERLAPPEDWINDOW
|
---|
| 28 | .lpszName = ""
|
---|
| 29 | '.lpszClass
|
---|
| 30 | .dwExStyle = 0
|
---|
| 31 | End With
|
---|
| 32 | End Sub
|
---|
| 33 | #include "FormEvent.sbp"
|
---|
| 34 | End Class
|
---|
| 35 |
|
---|
| 36 | End Namespace 'UI
|
---|
| 37 | End Namespace 'Widnows
|
---|
| 38 | End Namespace 'ActiveBasic
|
---|
| 39 |
|
---|
| 40 | '----------
|
---|
| 41 | 'テスト実行用
|
---|
| 42 |
|
---|
| 43 | #require <Classes/ActiveBasic/Windows/UI/Application.ab>
|
---|
| 44 |
|
---|
| 45 | Imports ActiveBasic.Windows.UI
|
---|
| 46 |
|
---|
| 47 | 'OleInitialize()
|
---|
| 48 | Control.Initialize(GetModuleHandle(0))
|
---|
| 49 |
|
---|
| 50 | Class MyForm
|
---|
| 51 | Inherits Form
|
---|
| 52 | Public
|
---|
| 53 | Sub MyForm()
|
---|
| 54 | Dim f = This
|
---|
| 55 | AddMessageEvent(WM_DESTROY, AddressOf (f.Destory))
|
---|
| 56 | AddPaintDC(AddressOf (f.Paint))
|
---|
| 57 | AddMouseClick(AddressOf (f.Mouse))
|
---|
| 58 | s = ""
|
---|
| 59 | End Sub
|
---|
| 60 |
|
---|
| 61 | Sub Destory(sender As Object, e As EventArgs)
|
---|
| 62 | OutputDebugString(Ex"Destory\r\n")
|
---|
| 63 | PostQuitMessage(0)
|
---|
| 64 | End Sub
|
---|
| 65 |
|
---|
| 66 | Sub Paint(sender As Object, e As PaintDCEventArgs)
|
---|
| 67 | TextOut(e.Handle, 10, 10, ToTCStr(s), s.Length)
|
---|
| 68 | End Sub
|
---|
| 69 |
|
---|
| 70 | Sub Mouse(sender As Object, e As MouseEventArgs)
|
---|
| 71 | Dim sb = New System.Text.StringBuilder
|
---|
| 72 | sb.Append("X = ").Append(e.X).Append(", Y = ").Append(e.Y)
|
---|
| 73 | s = sb.ToString
|
---|
| 74 | OutputDebugString(ToTCStr(s + " " + Hex$(ObjPtr(e)) + Ex"\r\n"))
|
---|
| 75 | Invalidate()
|
---|
| 76 | End Sub
|
---|
| 77 |
|
---|
| 78 | s As String
|
---|
| 79 | End Class
|
---|
| 80 |
|
---|
| 81 | Dim f = New MyForm
|
---|
| 82 | f.Create()
|
---|
| 83 | Application.Run(f)
|
---|
| 84 | f = Nothing
|
---|
| 85 | System.GC.Collect()
|
---|
| 86 |
|
---|
| 87 | Control.Uninitialize()
|
---|
| 88 | 'OleUninitialize()
|
---|
| 89 |
|
---|
| 90 | End
|
---|
| 91 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.