要向上面那样做是因为在窗体最小化时(borderstyle为bsNone)最大最小化按钮都不存在了!(这时只能双击最大化)
 

解决方案 »

  1.   

    form1.borderstyle:=bsNone;这样不行吗!
      

  2.   

    unit Unit1;interfaceuses
      ......;type
      TForm1 = class(TForm)
      private
        procedure WMSysCommand(var Msg: TWMSysCommand); message WM_SYSCOMMAND;
      public  end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.WMSysCommand(var Msg: TWMSysCommand);
    begin
      if (Msg.CmdType = SC_MINIMIZE) or (Msg.CmdType = SC_MAXIMIZE) then
      begin
        self.BorderStyle:=bsSizeable;
      end;
      DefaultHandler(Msg);
    end;end.
      

  3.   

    抱歉,可能我没有说清楚,当前的窗体在BsNone状态 至于haoqingqlm(木头)的写法。我早知道了,那种写法在borderstyle=bsSizeable状态下有用。在BsNone状态下是不行的
      

  4.   

    当前窗体的FormStyle:=fsstayontop ;
          borderstyle:=bsNone;
    你试一下
      

  5.   

    拦截消息:
    procedure TForm.WMSysCommand(var Msg:TMessage);
    begin
      if Msg.WParam=SC_Minmize then
        Form1.BorderStyle:=bsSizeable
      else 
        inherited; 
    end;
      

  6.   

    我发现是什么问题了!
     我同时处理两个消息。
      WM_SYSCOMMAND  wm_size
    然后在WM_SYSCOMMAND没有inherited,我对haoqingqlm( 木头)的说法是错的,在BsNone状态下行的
     
      谢谢大家!
      

  7.   

    继承WndProc方法。
    procedure WndProc(var Msg: TMessage); override;
    procedure TForm1.WndProc(var Msg: TMessage);
    begin
      if Msg.Msg = WM_KILLFOCUS then
        Self.BorderStyle := bsSizeable;
      inherited WndProc(Msg);
    end;