全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:5273
推到 Plurk!
推到 Facebook!

同時使用多個 TFrame Instance

 
dllee
站務副站長


發表:321
回覆:2519
積分:1711
註冊:2002-04-15

發送簡訊給我
#1 引用回覆 回覆 發表時間:2004-01-15 06:55:59 IP:211.76.xxx.xxx 未訂閱
回應問題: ■【BCB】【問題】請教大家TPanel與TFrame用法有什麼不同 http://delphi.ktop.com.tw/topic.php?TOPIC_ID=43116 因為自己以前也沒有好好用過 TFrame,只知道很好用,所以寫一個小程式作測試,提供大家作參考。    以下是建立多個 TFrame 的主程式及其注意事項。
//---------------------------------------------------------------------------
// testTFrame  測試同時使用多個 TFrame Instance by Lee, Dong-Liang
// 在設計時,只需要修改 TestFrameUnit 內的 TestFrame,將想要的元件及事件加入再
// Build 一次,即可在 FrameApp.exe 中看到多份相同的內容,每一份可以獨立操作。
// <2004-01-14> brought to you by http://dllee.ktop.com.tw
//---------------------------------------------------------------------------
#include 
#pragma hdrstop    #include "FrameAppUnit.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
  : TForm(Owner)
{
  for(int i=0;i<4;i++)
  {
    test[i]=new TTestFrame(this);
    test[i]->Name="test_"+String(i);  // 名字要改否則會因為同名而無法使用多份 TFrame
    test[i]->Parent=this;             // 指定 Parent 才會顯示
    test[i]->Left=300*(i%2);          // 指定 TFrame 放的位置
    test[i]->Top=200*(i/2);
    // 也可以直接操作 TFrame 內的元件或事件
    test[i]->Label1->Caption=test[i]->Name; // 顯示一下名稱
  }
}
//---------------------------------------------------------------------------
沒空更新的網頁... http://dllee.ktop.com.tw C及指標教學,計算機概論,資訊管理導論... http://dllee.adsldns.org 介紹Shells,LiteStep,GeoShell....
------
http://www.ViewMove.com
附加檔案:43594_testFrame.zip
系統時間:2024-04-26 1:16:10
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!