我想使我的程序的标题栏变得独特一点,希望能加上一点背景,改变一下颜色,最好能把最大最小化那几个按钮样式也变一下,就象XP风格这样的,但又不想用换肤控件,只想自己编程实现,哪位高手有这方面的文章或源码介绍一下,多谢了!

解决方案 »

  1.   

    用消息!
    uses messages...
    ....private
        procedure WMNCHitTest(VAR M:TWMNCHITTEST);message wm_NCHitTest;
    ....
    ....
    PROCEDURE TF_qqlist.WMNCHitTest(var M: Twmnchittest);
    begin
      inherited;
      if M.Result = htClient then
      begin    if (m.YPos - F_qqlist.top )<20 then
           begin
           m.result := htcaption;
           end ;   { if ((m.ypos -F_qqlist.Top ) >(F_qqlist.Height - 5 )) and
           ((m.xpos-F_qqlist.left) > (F_qqlist.Width -5)) then
            m.result :=htbottomright; //右下角
        if ((m.ypos-F_qqlist.top) > (F_qqlist.height-5)) and
           ((m.xpos-F_qqlist.left)< 5) then
           m.result:=htBottomleft;    //左下角
        if ((m.ypos-F_qqlist.top) < 5) and
           ((m.xpos-F_qqlist.left)< 5) then
           m.result:=httopleft;    //左上角
        if ((m.xpos - F_qqlist.left) >(F_qqlist.Width -5)) and
           ((m.ypos - F_qqlist.Top ) < 5) then
           m.result:=httopright;    //右上角    if ((m.ypos-F_qqlist.top) <5) and
            ((m.xpos-F_qqlist.left)> 5) and
            ((m.xpos - F_qqlist.left) <(F_qqlist.Width -5)) then
           m.result:=httop; //顶部    if ((m.ypos -F_qqlist.Top ) > (F_qqlist.Height - 5 )) and
           ((m.xpos-F_qqlist.left)<(F_qqlist.Width -5)) and
           ((m.xpos-F_qqlist.left)>5) then
           m.result:=htbottom;  //底部    if ((m.xpos-F_qqlist.left)<10) and
            ((m.ypos -F_qqlist.Top ) < (F_qqlist.Height - 5 )) and
             ((m.ypos-F_qqlist.top) > 5) then
           m.result:=htleft;    //左边
        if ((m.xpos-F_qqlist.left)>(F_qqlist.Width -10)) and
           ((m.ypos -F_qqlist.Top ) < (F_qqlist.Height - 5 )) and
           ((m.ypos - F_qqlist.Top ) > 5) then
           m.result:=htright;    //右边   }
      end;
    END;
    procedure TF_qqlist.FormResize(Sender: TObject);
    begin
     img_close.left:=F_qqlist.width-34;
    end;事先将caption 栏去掉(改为无边界)
    然后自己画一个image放在顶部,最大化,最小化按钮也一样.参见  鄙人的劣作:  QQ登陆号码清除器
    在CSDN 网络安全里
      

  2.   

    程序员大本营-delphi版中有类似源码