全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:723
推到 Plurk!
推到 Facebook!

繼承TButton元件並覆寫WndProc虛擬函式....卻異常???

尚未結案
donald_chen
一般會員


發表:9
回覆:2
積分:2
註冊:2004-04-22

發送簡訊給我
#1 引用回覆 回覆 發表時間:2005-01-06 18:05:20 IP:163.28.xxx.xxx 未訂閱
繼承TButton元件並覆寫WndProc虛擬函式....卻異常??? 連點擊Button外面的區域都會被KButton處理???    //---------------------------------------------------------------------------    #ifndef KButtonH #define KButtonH //--------------------------------------------------------------------------- #include  #include #include #include //--------------------------------------------------------------------------- class PACKAGE KButton : public TButton { private: protected: // virtual void __fastcall WndProc(Messages::TMessage &Message); public: __fastcall KButton(TComponent* Owner); __published: }; //--------------------------------------------------------------------------- #endif //--------------------------------------------------------------------------- #include #pragma hdrstop #include "KButton.h" #pragma package(smart_init) //--------------------------------------------------------------------------- // ValidCtrCheck is used to assure that the components created do not have // any pure virtual functions. // static inline void ValidCtrCheck(KButton *) { new KButton(NULL); } //--------------------------------------------------------------------------- __fastcall KButton::KButton(TComponent* Owner) : TButton(Owner) { } //--------------------------------------------------------------------------- namespace Kbutton { void __fastcall PACKAGE Register() { TComponentClass classes[1] = {__classid(KButton)}; RegisterComponents("Samples", classes, 0); } } //--------------------------------------------------------------------------- void __fastcall KButton::WndProc(Messages::TMessage &Message) { switch(Message.Msg){ case WM_LBUTTONDOWN: ShowMessage(Message.WParamHi); ShowMessage("Done by KButton"); break; } TButton::WndProc(Message); }
donald_chen
一般會員


發表:9
回覆:2
積分:2
註冊:2004-04-22

發送簡訊給我
#2 引用回覆 回覆 發表時間:2005-01-10 11:51:55 IP:163.28.xxx.xxx 未訂閱
問題已解決囉~~~
系統時間:2024-05-05 1:08:50
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!