controlbar上的dock2的元件 |
答題得分者是:axsoft
|
jason_cyl329
高階會員 發表:123 回覆:155 積分:105 註冊:2003-05-26 發送簡訊給我 |
|
axsoft
版主 發表:681 回覆:1056 積分:969 註冊:2002-03-13 發送簡訊給我 |
Jason_cyl329您好: 請試試
Creating a docking window like Class Explorer文章出處:http://www.visualcomponentlibrary.com/bcb/howto/dockwnd.htm-------------------------------------------------------------------------------- 1.Start a new application 2.From the Standard page of the Component Palette, double-click the Panel control. 3.Set the Align property of the new Panel to alLeft. Set the BevelOuter property to bvLowered. Also set the DockSite property to true. 4.While Panel1 is still selected, from the Standard page, double- click the Panel control. Set the Align property to alClient. Set the DragKind to dkDock and the DragMode to dmAutomatic. Optionally set the BevelOuter to bvNone and its Caption to Window Floater 5.While the Panel2 control is still selected, from the Win32 page, double-click the TreeView control. Set its Align property to alClient. 6.Double-click the selected TreeView1 control and create a basic tree view that would serve for illustration. 7.To test it, press F9. At this time, the TreeView1 control is dockable but there is a problem. When the application starts, the tree view doesn't appear the way we want it, even though we can drag it away and bring it back. Close the form. 8.Double-click an empty area on the form to access the form's OnCreate event. Implement it as follows: //--------------------------------------------------------------------------- void __fastcall TForm1::FormCreate(TObject *Sender) { TRect Recto(Left, Top, Left Panel1->Width, Top ClientHeight); Panel2->ManualFloat( Recto); Panel2->ManualDock(Panel1, Panel1, alClient); } //--------------------------------------------------------------------------- 9. To test the program again, press F9. 10.Remember that, at this time, if the user closes the docking or floating window, it disappears completely. To recover from that,you can provide a menu or a button that would easily toggle the appearance or disappearance of the docking window. Image you have a button on the form for that purpose. The OnClick event of that button can be implemented as follows (remember that, in our example, Panel2 is the real docking window while Panel1 is just the host of the floating window): //--------------------------------------------------------------------------- void __fastcall TForm1::Button1Click(TObject *Sender) { Panel2->Visible = !Panel2->Visible; } //--------------------------------------------------------------------------- 11.Do that and test the program.HAVE A NICE DAY FOR YOU |
axsoft
版主 發表:681 回覆:1056 積分:969 註冊:2002-03-13 發送簡訊給我 |
|
axsoft
版主 發表:681 回覆:1056 積分:969 註冊:2002-03-13 發送簡訊給我 |
動態產生Docking的寫法//--------------------------------------------------------------------------- //作者:axsoft //程式名稱:動態產生Docking的寫法 //程式碼參考來源:http://www.visualcomponentlibrary.com/bcb/howto/dockwnd.htm #includeHAVE A NICE DAY FOR YOU 發表人 - axsoft 於 2003/07/30 18:53:38 |
jason_cyl329
高階會員 發表:123 回覆:155 積分:105 註冊:2003-05-26 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |