線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:1768
推到 Plurk!
推到 Facebook!

動態產生元件之問題(再問)

答題得分者是:GeorgeKu
hsuanjen
一般會員


發表:6
回覆:2
積分:1
註冊:2004-09-07

發送簡訊給我
#1 引用回覆 回覆 發表時間:2005-05-24 11:37:15 IP:163.25.xxx.xxx 未訂閱
請教各位先進: 我有參考了之前別人的問題, http://delphi.ktop.com.tw/topic.php?TOPIC_ID=33711 我用這個方法確實可以動態產生TShape,但是我用同樣的方式 動態產生TStringGrid,卻會有以下的錯誤: [C++ Error] Unit1.cpp(41): E2451 Undefined symbol 'TStringGrid' [C++ Error] Unit1.cpp(41): E2451 Undefined symbol 'StringGrid1' [C++ Error] Unit1.cpp(42): E2303 Type name expected [C++ Error] Unit1.cpp(42): E2379 Statement missing     以下是我的程式碼(TShape):   TShape *shape[30];   for(int i=0;i<30;i ) { shape[i]=new TShape(Form1); shape[i]->Parent=Form1; shape[i]->Visible=true; shape[i]->Pen->Width=1; shape[i]->Pen->Color=clBlack; shape[i]->Brush->Color=clRed; shape[i]->Brush->Style=bsSolid; shape[i]->Shape = stCircle; shape[i]->Width=10; shape[i]->Height=10; shape[i]->Left=10 10*i; shape[i]->Top=10 ; 以下是我的程式碼(TStringGrid): TStringGrid *StringGrid1; StringGrid1 = new TStringGrid(Form1); StringGrid1->Visible = true; StringGrid1->Enabled = true; StringGrid1->Parent = Form1; StringGrid1->Width = 550; StringGrid1->Height = 200; StringGrid1->Top = 50; StringGrid1->Left = 0; 我有參考書上的作法,在標頭檔中(.h)的 Public 裡面宣告,但是 還是會有錯誤。 另外讓我覺得有趣的是如果我自己先再加入一個StringGrid元件 的話(非動態產生),程式就不會有Error,麻煩各位先進 替我解答一下,謝謝! K.Top 讚!! 發表人 - hsuanjen 於 2005/05/24 11:40:18
GeorgeKu
中階會員


發表:1
回覆:120
積分:74
註冊:2004-10-13

發送簡訊給我
#2 引用回覆 回覆 發表時間:2005-05-24 12:33:37 IP:61.228.xxx.xxx 未訂閱
hsuanjen,    你可能忘記放這個進去你的.h檔
#include 
發表人 - georgeku 於 2005/05/24 12:35:13
RedSnow
版主


發表:79
回覆:1322
積分:845
註冊:2003-12-15

發送簡訊給我
#3 引用回覆 回覆 發表時間:2005-05-24 12:34:56 IP:219.137.xxx.xxx 未訂閱
hsuanjen 您好:    應該是在 .h 檔裡邊未做對應的 include 設定: #include <Grids.hpp> 加上去試試看吧。
hsuanjen
一般會員


發表:6
回覆:2
積分:1
註冊:2004-09-07

發送簡訊給我
#4 引用回覆 回覆 發表時間:2005-05-24 13:03:40 IP:163.25.xxx.xxx 未訂閱
引言: hsuanjen, 你可能忘記放這個進去你的.h檔
#include 
發表人 - georgeku 於 2005/05/24 12:35:13
您說的沒錯,是我疏忽了..謝謝指教~~ K.Top 讚!!
系統時間:2024-04-20 18:48:10
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!