又到了一天一问的时候了,呵呵~~
问题:如何重载TImage控件的wndproc?
我是这么做的:
头文件:
//---------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TImage *Image1;
private: // User declarations
void __fastcall myWndProc(Messages::TMessage &Message);
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
单元文件:
//-------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
Image1->WindowProc=myWndProc;
}
void __fastcall TForm1::myWndProc(Messages::TMessage &Message)
{
switch(Message.Msg)
{
case WM_PAINT:
OutputDebugString("Recv WM_PAINT");
break;
}
Dispatch(&Message);
}
但是根本没有拦截到WM_PAINT这个消息。我哪里搞错了?