動態生成StringGrid,使用OnDrawCell事件? |
答題得分者是:李國維
|
deanmac85
一般會員 發表:13 回覆:4 積分:3 註冊:2007-05-29 發送簡訊給我 |
動態生成StringGrid,使用OnDrawCell事件?
為什麼compiler會有錯誤,該如何修改,這個事件不能這樣用嗎? 還是有其他方式? [code cpp] public: // User declarations __fastcall TForm1(TComponent* Owner); TStringGrid *pSetSG ; void __fastcall SGDrawCell(TObject *Sender, int ACol,int ARow, TRect &Rect, TGridDrawState State); [/code] [code cpp] __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { pSetSG = new TStringGrid(this); pSetSG->OnDrawCell = &SGDrawCell; } //--------------------------------------------------------------------------- void __fastcall TForm1::SGDrawCell(TObject *Sender, int ACol, int ARow, TRect &Rect, TGridDrawState State) { // } [/code] |
李國維
高階會員 發表:42 回覆:287 積分:235 註冊:2003-02-07 發送簡訊給我 |
pSetSG->OnDrawCell = (Grids::TDrawCellEvent)&SGDrawCell;
===================引 用 deanmac85 文 章=================== 動態生成StringGrid,使用OnDrawCell事件? 為什麼compiler會有錯誤,該如何修改,這個事件不能這樣用嗎? 還是有其他方式? [code cpp] public:// User declarations __fastcall TForm1(TComponent* Owner); TStringGrid *pSetSG ; void __fastcall SGDrawCell(TObject *Sender, int ACol,int ARow, TRect &Rect, TGridDrawState State); [/code] [code cpp] __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { pSetSG = new TStringGrid(this); pSetSG->OnDrawCell = &SGDrawCell; } //--------------------------------------------------------------------------- void __fastcall TForm1::SGDrawCell(TObject *Sender, int ACol, int ARow, TRect &Rect, TGridDrawState State) { // } [/code] |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |