Track Bar很是人性化,不会跟自己之前的经验冲突。Track Bar下面那些杠杠原来是自己插入的,还能改,还真是想干啥就能干啥……

1 #include "..\..\..\..\VL++\Library\Windows\VL_WinGUI.h"
2
3 using namespace vl;
4 using namespace vl::windows;
5
6 class MyForm : public VL_WinForm
7 {
8 protected:
9 VL_WinTrack* FTrack;
10 VL_WinEdit* FEdit;
11
12 void InitControls()
13 {
14 FTrack=new VL_WinTrack(this,true);
15 FTrack->Move(10,10,380,30);
16 FTrack->SetAutoTicks(true);
17 FTrack->BuildAutoTicks(1);
18 FTrack->SetEnableSelection(true);
19 FTrack->SetSelStart(3);
20 FTrack->SetSelEnd(8);
21 FEdit=new VL_WinEdit(this,true);
22 FEdit->Move(10,50,380,340);
23 FEdit->SetReadonly(true);
24
25 FTrack->OnArrowDec.Bind(this,&MyForm::Scroll_ArrowDec);
26 FTrack->OnArrowInc.Bind(this,&MyForm::Scroll_ArrowInc);
27 FTrack->OnPageDec.Bind(this,&MyForm::Scroll_PageDec);
28 FTrack->OnPageInc.Bind(this,&MyForm::Scroll_PageInc);
29 FTrack->OnTracking.Bind(this,&MyForm::Scroll_Tracking);
30 FTrack->OnThumbUp.Bind(this,&MyForm::Scroll_ThumbUp);
31 FTrack->OnPositionChanged.Bind(this,&MyForm::Scroll_PositionChanged);
32 FTrack->OnEndScroll.Bind(this,&MyForm::Scroll_EndScroll);
33 }
34
35 void Print(VUnicodeString Message)
36 {
37 FEdit->SetText(FEdit->GetText()+Message+L"\r\n");
38 FEdit->Select(FEdit->GetText().Length(),0);
39 FEdit->ScrollToCaret();
40 }
41
42 void Print(VL_Base* Sender , VUnicodeString Message)
43 {
44 VL_WinTrack* Track=dynamic_cast<VL_WinTrack*>(Sender);
45 if(Track)
46 {
47 Print(L"Vertical , "+Message+L" = "+VUnicodeString(Track->GetPosition()));
48 }
49 }
50
51 void Scroll_ArrowDec(VL_Base* Sender)
52 {
53 Print(Sender,L"Arrow-");
54 }
55
56 void Scroll_ArrowInc(VL_Base* Sender)
57 {
58 Print(Sender,L"Arrow+");
59 }
60
61 void Scroll_PageDec(VL_Base* Sender)
62 {
63 Print(Sender,L"Page-");
64 }
65
66 void Scroll_PageInc(VL_Base* Sender)
67 {
68 Print(Sender,L"Page+");
69 }
70
71 void Scroll_Tracking(VL_Base* Sender)
72 {
73 Print(Sender,L"Tracking");
74 }
75
76 void Scroll_ThumbUp(VL_Base* Sender)
77 {
78 Print(Sender,L"ThumbUp");
79 }
80
81 void Scroll_PositionChanged(VL_Base* Sender)
82 {
83 Print(Sender,L"Changed");
84 }
85
86 void Scroll_EndScroll(VL_Base* Sender)
87 {
88 Print(Sender,L"End");
89 }
90
91 public:
92
93 MyForm():VL_WinForm(true)
94 {
95 SetMaximizeBox(false);
96 SetBorder(vwfbSingle);
97 SetClientWidth(400);
98 SetClientHeight(400);
99 SetText(L"Vczh Form");
100 MoveCenter();
101 InitControls();
102 Show();
103 }
104 };
105
106 void main()
107 {
108 new MyForm;
109 GetApplication()->Run();
110 }
posted on 2008-08-15 08:28
陈梓瀚(vczh) 阅读(1767)
评论(1) 编辑 收藏 引用 所属分类:
C++