Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

有關Delphi 5的問題~~~元件新增

0 views
Skip to first unread message

Bobby

unread,
Apr 29, 2002, 12:15:42 PM4/29/02
to
請問大家...我在Form上放一個PageControl...執行時按下Button會在PageControl上動態新增一個Sheet...但問題來了,我想在剛新增的Sheet上新增一個RichEdit物件...該怎麼做呢?
感謝大家的回答~~~

--
----== Posted via Openfind 網路論壇 ==-----
http://bbs.openfind.com.tw/ 提供免費的登載文章及查詢服務
※來源:211.74.*


hippy

unread,
Apr 30, 2002, 2:20:25 AM4/30/02
to
hi~
只要把你動態 create 出來的 richedit 的 parent 設成新增出來的那個 sheet 就行
了。

"Bobby" <bob...@bbs.openfind.com.tw> 撰寫於郵件
news:0AAJRJE$00016FT$1...@bbs.openfind.com.tw...
> 請問大家...我在Form上放一個PageControl...執行時按下Button會在PageControl上
動態新增一個Sheet...但問題來了,我想在剛新增的Sheet上新增一個RichEdit物件...

Bobby

unread,
Apr 30, 2002, 6:38:15 AM4/30/02
to
先感謝您的回答~~~但...我不是很懂 ><"~~~以下是我的程式碼~~~我該怎麼改呢?

with TTabSheet.Create(pgc) do //pgc是已經佈置在form上的pagecontrol~~~
begin
PageControl := pgc;
Name := 'ts' + IntToStr(tsCounter);
Caption := '文件' + IntToStr(tsCounter);
end;
pgc.ActivePageIndex := pgc.PageCount-1;
with TRichEdit.Create(pgc.ActivePage) do
begin
Name := 're' + IntToStr(tsCounter);
Align := alClient;
ScrollBars := ssBoth;
end;
tsCounter:=tsCounter+1; //用tsCounter計算新增的TSheet...每新增一個+1

※ 引述《"hippy" <hi...@taiwan.com>》之銘言:


> hi~
> 只要把你動態 create 出來的 richedit 的 parent 設成新增出來的那個 sheet 就行
> 了。

--

hippy

unread,
May 2, 2002, 6:05:46 AM5/2/02
to
hi~
我想直接在
with TRichEdit.Create(pgc.ActivePage) do
加上這一行:Parent := pgc.ActivePage;
應該就可以了~
...
end;

"Bobby" <bob...@bbs.openfind.com.tw> 撰寫於郵件
news:0AALS6N$0000FJN$1...@bbs.openfind.com.tw...
> 先感謝您的回答~~~但...我不是很懂 ><"~~~以下是我的程式碼~~~我該怎麼改呢?
>
> with TTabSheet.Create(pgc) do file://pgc是已經佈置在form上的


pagecontrol~~~
> begin
> PageControl := pgc;
> Name := 'ts' + IntToStr(tsCounter);
> Caption := '文件' + IntToStr(tsCounter);
> end;
> pgc.ActivePageIndex := pgc.PageCount-1;
> with TRichEdit.Create(pgc.ActivePage) do
> begin
> Name := 're' + IntToStr(tsCounter);
> Align := alClient;
> ScrollBars := ssBoth;
> end;

> tsCounter:=tsCounter+1; file://用tsCounter計算新增的TSheet...每新增一個+1

Bobby

unread,
May 2, 2002, 6:57:38 AM5/2/02
to
可以了~~~真是感謝您的幫忙~~~謝謝了! ^^

※ 引述《"hippy" <hi...@taiwan.com>》之銘言:
> hi~

> 我想直接在
> with TRichEdit.Create(pgc.ActivePage) do
> 加上這一行:Parent := pgc.ActivePage;
> 應該就可以了~

--

0 new messages