marky1
一般會員
![](./myimg/board/mystar_empty.gif)
![](images/icon_photo_none.gif) 發表:17 回覆:29 積分:9 註冊:2003-03-19
發送簡訊給我
|
於
http://delphi.ktop.com.tw/topic.php?TOPIC_ID=18752
http://delphi.ktop.com.tw/topic.php?TOPIC_ID=35307
有相關說明
但都無法產生任意個 我試了下面程式
TImage **NewImg;
for(WORD i=0; i
但執行時出現EAccessViolation錯誤
請先進指教
謝謝 發表人 - marky1 於 2003/09/03 13:56:09
|
RaynorPao
版主
![](./myimg/board/mystar.gif) ![](./myimg/board/mystar.gif) ![](./myimg/board/mystar.gif) ![](./myimg/board/mystar.gif) ![](./myimg/board/mystar.gif)
![](http://delphi.ktop.com.tw/download.php?download=upload/48c9d66ac5033_KTOP-%E5%8C%85%E5%AD%90%28%E7%9C%BC%E9%8F%A1%29-Q-100x100.jpg) 發表:139 回覆:3622 積分:7025 註冊:2002-08-12
發送簡訊給我
|
引言:
於
http://delphi.ktop.com.tw/topic.php?TOPIC_ID=18752
http://delphi.ktop.com.tw/topic.php?TOPIC_ID=35307
有相關說明
但都無法產生任意個 我試了下面程式
TImage **NewImg;
for(WORD i=0; i marky1 你好:
請參考以下的做法
< class="code">
TList *gList;
TImage *gImage;
void __fastcall TForm1::Button1Click(TObject *Sender)
{
gImage=new TImage(Application);
gImage->Parent=this;
gList->Add(gImage);
gImage->Width=20;
gImage->Height=20;
gImage->Left=8 (gImage->Width 10)*(gList->Count-1);
gImage->Top=8;
gImage->Canvas->Brush->Color=clWhite;
gImage->Canvas->FillRect(Rect(0, 0, gImage->Width, gImage->Height));
}
void __fastcall TForm1::Button2Click(TObject *Sender)
{
if(gList->Count>0)
{
delete (TImage*)gList->Items[gList->Count-1];
gList->Delete(gList->Count-1);
}
}
void __fastcall TForm1::FormCreate(TObject *Sender)
{
gList=new TList;
}
void __fastcall TForm1::FormDestroy(TObject *Sender)
{
delete gList;
}
-- Enjoy Researching & Developing --
------ -- 若您已經得到滿意的答覆,請適時結案!! --
-- 欲知前世因,今生受者是;欲知來世果,今生做者是 --
-- 一切有為法,如夢幻泡影,如露亦如電,應作如是觀 --
|
marky1
一般會員
![](./myimg/board/mystar_empty.gif)
![](images/icon_photo_none.gif) 發表:17 回覆:29 積分:9 註冊:2003-03-19
發送簡訊給我
|
感激 RaynorPao 版主 的答覆,
您使用TList的作法正是我要的!
help上對於List亦有詳盡的example,
有需要的人也可以參考。
若其他先進有其他作法,
歡迎分享,
謝謝!
|
smilebye
一般會員
![](./myimg/board/mystar_empty.gif)
![](images/icon_photo_none.gif) 發表:21 回覆:33 積分:10 註冊:2004-01-18
發送簡訊給我
|
引言:
marky1 你好:
請參考以下的做法
< class="code">
TList *gList;
TImage *gImage;
void __fastcall TForm1::Button1Click(TObject *Sender)
{
gImage=new TImage(Application);
gImage->Parent=this;
gList->Add(gImage);
gImage->Width=20;
gImage->Height=20;
gImage->Left=8 (gImage->Width 10)*(gList->Count-1);
gImage->Top=8;
gImage->Canvas->Brush->Color=clWhite;
gImage->Canvas->FillRect(Rect(0, 0, gImage->Width, gImage->Height));
}
void __fastcall TForm1::Button2Click(TObject *Sender)
{
if(gList->Count>0)
{
delete (TImage*)gList->Items[gList->Count-1];
gList->Delete(gList->Count-1);
}
}
void __fastcall TForm1::FormCreate(TObject *Sender)
{
gList=new TList;
}
void __fastcall TForm1::FormDestroy(TObject *Sender)
{
delete gList;
}
ㄟ|||可不可以稍微解釋一下內容,跟每個宣告,...因為不是很了解意思^^: 我是新手,程式設計的菜鳥>< 嗚~請多幫忙唷! 發表人 - smilebye 於 2004/01/31 01:22:11
------ 我是新手,程式設計的菜鳥>< 嗚~請多幫忙唷!
|