继承组件
我继承了TLabeledEdit组件,想改变他边框的颜色,但是我写好以后,测试这个组件的时候他会闪烁,请问怎么回事呢?这是代码:
__fastcall TLabeledEdit1::TLabeledEdit1(TComponent* Owner)
: TLabeledEdit(Owner)
{
OldProc = this->WindowProc;
this->WindowProc = WinProc;
}
//---------------------------------------
void __fastcall TLabeledEdit1::WinProc(TMessage &message)
{
if(message.Msg == WM_PAINT)
{
this->Dispatch(&message);
this->DoubleBuffered = true;
TRect r;
r.Left = 0;
r.Top = 0;
r.Right = this->Width;
r.Bottom = this->Height;
HDC dc= GetDC(this->Handle);
TCanvas *can = new TCanvas();
can->Handle = dc;
can->Brush->Style = bsClear;
can->Pen->Width = 1;
can->Pen->Color = RGB(167,189,210); //颜色自己定
can->Rectangle(r);
ReleaseDC(this->Handle,dc);
delete can;
}
OldProc(message);
}
[解决办法]
怎么个闪烁啊,我测得看不出来么