--
----== Posted via Openfind 網路論壇 ==-----
http://bbs.openfind.com.tw/ 提供免費的登載文章及查詢服務
※來源:211.74.*
"Bobby" <bob...@bbs.openfind.com.tw> 撰寫於郵件
news:0AAJRJE$00016FT$1...@bbs.openfind.com.tw...
> 請問大家...我在Form上放一個PageControl...執行時按下Button會在PageControl上
動態新增一個Sheet...但問題來了,我想在剛新增的Sheet上新增一個RichEdit物件...
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 就行
> 了。
--
"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
※ 引述《"hippy" <hi...@taiwan.com>》之銘言:
> hi~
> 我想直接在
> with TRichEdit.Create(pgc.ActivePage) do
> 加上這一行:Parent := pgc.ActivePage;
> 應該就可以了~
--