怎么让 bsNone的form能Sizeable呢? 急,在线等啊,大侠指教~~~

解决方案 »

  1.   

    unit Resize;interfaceuses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
      StdCtrls;type
      TForm1 = class(TForm)
        Button1: TButton;
        procedure FormCreate(Sender: TObject);
        procedure FormResize(Sender: TObject);
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
        lpRect:TRect;
        mess1:string;
        procedure hitit(var msg:TWMNCHITTEST);
           message WM_NCHITTEST;
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.DFM}procedure TForm1.hitit(var msg: TWMNCHITTEST);
    var
       pt:TPoint;
    begin
       pt.x:=msg.XPos;
       pt.y:=msg.YPos;
       pt:=ScreenToClient(pt);if ptInRect(Rect(lpRect.Right-5,lpRect.Top+5,
                lpRect.Right+5,lpRect.Bottom-5),pt) then
       msg.Result:=HTRIGHT;//右边
    if ptInRect(Rect(lpRect.Left-5,lpRect.Top+5,
                lpRect.Left+5,lpRect.Bottom-5),pt) then
       msg.Result:=HTLEFT; //左边if ptInRect(Rect(lpRect.Left+5,lpRect.Top-5,
                lpRect.Right-5,lpRect.Top+5),pt) then
       msg.Result:=HTTOP; //上边
    if ptInRect(Rect(lpRect.Left+5,lpRect.Bottom-5,
                lpRect.Right-5,lpRect.Bottom+5),pt) then
       msg.Result:=HTBOTTOM; //下边if ptinRect(Rect(lpRect.Left-5,lpRect.Top-5,
               lpRect.Left+5,lpRect.Top+5),pt) then
       msg.Result:=HTTOPLEFT;//左上角
    if ptInRect(Rect(lpRect.Right-5,lpRect.Bottom-5,
                lpRect.Right+5,lpRect.Bottom+5),pt) then
       msg.Result:=HTBOTTOMRIGHT;//右下角if ptInRect(Rect(lpRect.Left-5,lpRect.Bottom-5,
                lpRect.Left+5,lpRect.Bottom+5),pt) then
       msg.Result:=HTBOTTOMLEFT; //左下角
    if ptInRect(Rect(lpRect.Right-5,lpRect.Left-5,
                lpRect.Right+5,lpRect.Left+5),pt) then
       msg.Result:=HTTOPRIGHT; //右上角end;procedure TForm1.FormCreate(Sender: TObject);
    begin
      lpRect:=ClientRect;
    end;procedure TForm1.FormResize(Sender: TObject);
    begin
      lpRect:=ClientRect;
    end;procedure TForm1.Button1Click(Sender: TObject);
    begin
      close;
    end;end.
      

  2.   

    on sentence:
    setwindowlong(handle,GWL_STYLE, getwindowlong(handle,GWL_STYLE) and (not WS_CAPTION));
      

  3.   

    To   wfhlxl() :   大侠,你的代码没用哦,你试试啊,把form的BordStyle设成bsNone,然后用你的代码,启动后不能sizeable的,~~~
      

  4.   

    除非你不设成bsNone,可是我的窗体必须要是bsNone的,否则会很难看的。
      

  5.   

    fei19790920(饭桶的马甲(抵制日货)) 的代码可以用,谢谢。
    还有其他的答案嘛? 中午午饭前揭帖。谢谢各位捧场
      

  6.   

    不把form的BordStyle设成bsNone
    call up fucntion and 把form的BordStyle设成bsNone
    在外观上有what deference.
      

  7.   

    put these into formcreate
    width:=width-1`;
    width:=width+1;
      

  8.   

    To  wfhlxl() :
     我试了,这样还是没有达到bsNone的样式:也就是说窗体四周还有边框!  我现在是要将一张图片alClient到form上,如果用你的方法,运行时窗体四周还是有边框很难看,而bsNone后整个窗体都是被图片覆盖的。
     午饭去了,谢谢各位的热心,揭帖了