比如全屏状态下。

解决方案 »

  1.   

    type
      TForm1 = class(TForm)
      private
        { Private declarations }
        procedure WmNchittest(var msg:Tmessage);
        message WM_NCHITTEST;
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}
    procedure TForm1.WmNchittest(var msg:Tmessage);
    begin
      inherited;
      if msg.Result=htcaption then msg.Result:=htclient;
    end;
      

  2.   

    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;type
      TForm1 = class(TForm)
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
        FCanDrag: Boolean;                      // 可否被拖动
        procedure WMNChittest(var Msg: TMessage); message WM_NCHITTEST;
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}{ TForm1 }procedure TForm1.WMNChittest(var Msg: TMessage);
    begin
      inherited;
      if (Msg.Result = HTCAPTION) and (not FCanDrag) then Msg.Result := HTCLIENT;
    end;procedure TForm1.Button1Click(Sender: TObject);
    begin
      FCanDrag := not FCanDrag;               // 当按下按钮时,改变FCanDrag
    end;end.
      

  3.   

    那你还写什么代码,直接align设为alclient好了,全频的当然不能拖动了
      

  4.   

    // 这样试试:unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;type
      TForm1 = class(TForm)
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}{ TForm1 }procedure TForm1.Button1Click(Sender: TObject);
    begin
      if BorderStyle = bsNone then BorderStyle := bsSizeable
      else  BorderStyle := bsNone;
    end;end.
      

  5.   

    谢谢大家,知道怎么处理了。  在 全屏状态,将 htcaption上捕获的 左键按下消息屏蔽就行了。