線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:1408
推到 Plurk!
推到 Facebook!

controlbar上的dock2的元件

答題得分者是:axsoft
jason_cyl329
高階會員


發表:123
回覆:155
積分:105
註冊:2003-05-26

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-07-30 13:08:59 IP:61.218.xxx.xxx 未訂閱
請問:     如何設定在controlbar或是coolbar上的元件有如下列圖示中左邊有個x的系統按鈕,按下後這個視窗就會消失!!
axsoft
版主


發表:681
回覆:1056
積分:969
註冊:2002-03-13

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-07-30 14:44:30 IP:61.218.xxx.xxx 未訂閱
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

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-07-30 15:45:38 IP:61.218.xxx.xxx 未訂閱
範例實做如下:    下載:http://delphi.ktop.com.tw/loadfile.php?TOPICID=10923713&CC=244307         設計階段 執行階段 按下「X」按鈕或者Button HAVE A NICE DAY FOR YOU
axsoft
版主


發表:681
回覆:1056
積分:969
註冊:2002-03-13

發送簡訊給我
#4 引用回覆 回覆 發表時間:2003-07-30 18:47:05 IP:61.218.xxx.xxx 未訂閱

動態產生Docking的寫法

//---------------------------------------------------------------------------
//作者:axsoft
//程式名稱:動態產生Docking的寫法
//程式碼參考來源:http://www.visualcomponentlibrary.com/bcb/howto/dockwnd.htm    #include 
#pragma hdrstop    #include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
TPanel *Panel2;
TPanel *Panel1;
TMemo *Memo1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{    }
//---------------------------------------------------------------------------    void __fastcall TForm1::FormCreate(TObject *Sender)
{     Panel1=new TPanel(this);
 Panel1->Parent=this;
 Panel1->Caption="Panel1";
 Panel1->Align=alLeft;
 Panel1->DockSite=true;
 Panel1->DragKind= dkDock;     Panel1->UseDockManager=true;     Panel2=new TPanel(this);
 Panel2->Parent=Form1;
 Panel2->Align=alClient;
 Panel2->Caption="Panel2";
 Panel2->DockSite =True;
 Panel2->DragKind= dkDock;
 Panel2->DragMode=dmAutomatic;
 Panel2->BevelOuter=bvLowered;     Memo1=new TMemo(this);
 Memo1->Parent=Panel2;
 Memo1->Align=alClient;     TRect Recto(Left, Top, Left   Panel1->Width, Top   ClientHeight);
 Panel2->ManualFloat( Recto);
 Panel2->ManualDock(Panel1, Panel1, alClient);    }
//---------------------------------------------------------------------------    void __fastcall TForm1::Button1Click(TObject *Sender)
{
 Panel2->Visible = !Panel2->Visible;    }
//---------------------------------------------------------------------------
HAVE A NICE DAY FOR YOU 發表人 - axsoft 於 2003/07/30 18:53:38
jason_cyl329
高階會員


發表:123
回覆:155
積分:105
註冊:2003-05-26

發送簡訊給我
#5 引用回覆 回覆 發表時間:2003-07-30 20:18:57 IP:61.218.xxx.xxx 未訂閱
感謝版主的熱情贊助!!
系統時間:2024-09-10 10:48:19
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!