source: trunk/ab5.0/ablib/TestCase/UI_Sample/step5_DayTimeCheck.ab@ 561

Last change on this file since 561 was 561, checked in by イグトランス (egtra), 16 years ago

EditBox, TaskMsgの追加。

File size: 1.9 KB
Line 
1/*!
2@file
3@brief 「Win32プログラミング講座 ~ Step5. ボタン コントロールを使う ~」のAB5移植版
4http://www.activebasic.com/help_center/articles/win32/step05/
5
6@date 2008/07/20
7@auther Egtra
8*/
9
10#require <Classes/ActiveBasic/Windows/UI/Form.ab>
11#require <Classes/ActiveBasic/Windows/UI/Application.ab>
12#require <Classes/ActiveBasic/Windows/UI/Button.ab>
13#require <Classes/ActiveBasic/Windows/UI/TaskMsg.ab>
14
15Imports ActiveBasic.Windows.UI
16Imports System
17
18#resource "UI_Sample.rc"
19
20Class DayTimeCheckForm
21 Inherits Form
22Public
23 Sub DayTimeCheckForm()
24 AddCreate(AddressOf(OnCreate))
25 End Sub
26
27Protected
28 Override Sub GetCreateStruct(ByRef cs As CREATESTRUCT)
29 Super.GetCreateStruct(cs)
30 With cs
31 .style = WS_OVERLAPPED Or WS_CAPTION Or WS_SYSMENU Or WS_DLGFRAME Or WS_MINIMIZEBOX
32 .cx = 140
33 .cy = 130
34 End With
35 End Sub
36
37Private
38 Sub OnCreate(sender As Object, e As CreateArgs)
39 buttonDate = New Button
40 buttonTime = New Button
41 Dim wpHFontControl = GetStockObject(DEFAULT_GUI_FONT) As WPARAM
42 With buttonDate
43 .Create(This)
44 .Text = "今日は何日?"
45 .Move(30, 20, 80, 30)
46 .AddClick(AddressOf(ButtonDate_Click))
47 .SendMessage(WM_SETFONT, wpHFontControl, 0)
48 End With
49
50 With buttonTime
51 .Create(This)
52 .Text = "今何時?"
53 .Move(30, 60, 80, 30)
54 .AddClick(AddressOf(ButtonTime_Click))
55 .SendMessage(WM_SETFONT, wpHFontControl, 0)
56 End With
57 End Sub
58
59 Sub ButtonDate_Click(sender As Object, e As Args)
60 TaskMsg(This, "今日の日付", DateTime.Today.GetDateTimeFormats("yyyy/MM/dd"), Nothing, MB_OK)
61 End Sub
62
63 Sub ButtonTime_Click(sender As Object, e As Args)
64 TaskMsg(This, "今日の日付", DateTime.Now.GetDateTimeFormats("H:mm:ss"), Nothing, MB_OK)
65 End Sub
66
67 buttonDate As Button
68 buttonTime As Button
69End Class
70
71Control.Initialize(GetModuleHandle(0))
72Dim f = New DayTimeCheckForm
73f.Create()
74Application.Run(f)
Note: See TracBrowser for help on using the repository browser.