松鼠的博客

导航

TFrame控件背景自绘

(1)在Frame框架窗口中增加 TApplicationEvent 对象
(2)响应 TApplicationEvent 的 Message 消息
(3)编写 WM_PAINT 消息的代码:

void __fastcall TFrame1::ApplicationEvents1Message(tagMSG &Msg,
      
bool &Handled)
{
    
switch(Msg.message)
    
{
        
case WM_PAINT://自绘
            gdip::Graphics gdi(this->Handle);
            gdip::SolidBrush bsh(gdip::Color(
195,243,229));
            gdip::Rect rect(
0,0,this->Width,this->Height);
            gdi.FillRectangle(
&bsh,rect);
        
break;
    }

}

posted on 2008-12-02 09:47  Xproer-松鼠  阅读(299)  评论(0)    收藏  举报