孤独的猫

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

1.在private定义消息函数

  procedure WMNCPaint(var Msg:TWMNCPaint);message WM_NCPaint;

 

2.WMNCPaint函数为

procedure TForm1.WMNCPaint(var Msg:TWMNCPaint);

var

    dc:hDc;

    Pen:hPen;

    OldPen:hPen;

    OldBrush:hBrush;

begin

    inherited;

    dc :=GetWindowDC(handle);

    Pen :=CreatePen(PS_SOLID,1,RGB(255,0,0));

    OldPen :=SelectObject(dc,Pen);

    OldBrush :=SelectObject(dc,GetStockObject(NULL_BRUSH));

    Rectangle(dc,0,0,Form1.Width,Form1.Height);

    SelectObject(dc,OldBrush);

    SelectObject(dc,OldPen);

    DeleteObject(Pen);

    ReleaseDC(handle,Canvas.handle);

end;

posted on 2008-09-12 20:25  孤独的猫  阅读(193)  评论(0编辑  收藏  举报