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

如何將image元件 可以隨意的拖放到PageControl1 內的任一Sheet 上呢?

缺席
bome2002
一般會員


發表:11
回覆:9
積分:4
註冊:2005-11-04

發送簡訊給我
#1 引用回覆 回覆 發表時間:2006-10-19 09:52:15 IP:61.63.xxx.xxx 訂閱
請教各位大大
我以 Button2動態產生5個 sheet 在 PageControl1上 並每一Sheet 產生一個tmpImage1(背景圖)在每一Sheet上面
以Button1 動態產生10個 tmpImage2 在 GroupBox1 內
如何將GroupBox1 內的tmpImage2元件 可以隨意的拖放到PageControl1 內的任一Sheet (在背景圖之上)上呢?
//---------------------------------------------------------------------------
#include
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
String PictureName ="a.bmp";
int left = 20;
for(int i=0 ; i< 10 ;i )
{
TImage *tmpImage2 = new TImage(GroupBox1);
tmpImage2->Parent = GroupBox1;
tmpImage2->Picture->LoadFromFile(ExtractFilePath("Application.ExeName") PictureName);
tmpImage2->Left =left;
tmpImage2->DragMode = dmAutomatic;
tmpImage2->Stretch = true ;
tmpImage2->ShowHint = true;
left =40;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
String filename="A.bmp";
for(int i=1 ;i <= 5; i )
{
TTabSheet *pPage = new TTabSheet(PageControl1);
TImage *tmpImage1 = new TImage(this);
pPage->PageControl = PageControl1;
pPage->Caption = "Floor" IntToStr(i);
tmpImage1->Parent = pPage;
tmpImage->Picture->LoadFromFile(ExtractFilePath("Application.ExeName") (filename));
tmpImage1->Stretch =true;
}
}
//---------------------------------------------------------------------------

附加檔案:4536da4fc82be_form1.JPG
系統時間:2024-05-05 4:47:39
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!