建立无标题窗口

发布时间:2011年3月13日 作者:未知 查看次数:2223

建立无标题窗口


建立无标题窗口

1、代码
procedure   TForm1.FormCreate(Sender:   TObject);  
  begin  
      SetWindowLong(Form1.Handle,  
                                  GWL_STYLE,  
                                  GetWindowLong(Handle,GWL_STYLE)   and   not   WS_CAPTION);  
      Height   :=   ClientHeight;  
  end;  
  ///////////////////////////////////////////////////////////  
  procedure   TForm1.CreateParams(var   Params:   TCreateParams);  
  begin  
      inherited   createparams(params);  
      with   params   do  
      begin  
          style:=style   and   (not   ws_caption);  
          style:=style   or   ws_popup   or   ws_thickframe   or   ws_clipchildren;  
      end;  
  end


2、设置
把borderstyle设为bsnone

3、代码
borderstyle设bsnone  
   
  放一个Image,放一张图片  
  然后在onmousedown中加入代码:  
  procedure   TForm1.ResizeBtnMouseDown(Sender:   TObject;   Button:   TMouseButton;  
      Shift:   TShiftState;   X,   Y:   Integer);  
  const   SC_DRAGMOVE:Longint=$F008;//这个数字你可以改,自己看看效果  
  begin  
  if   (Self.WindowState=wsNormal)   then  
      begin  
      ReleaseCapture;  
      SendMessage(Self.Handle,WM_SYSCOMMAND,SC_DRAGMOVE,0);                 //向窗体发送改变大小消息  
      end;  
  end;



版权所有!www.sieye.cn
E.Mail:sieye@sohu.com QQ:66697110