不是变为灰色,而是彻底去掉;只保留最化化按钮跟关闭按钮?

解决方案 »

  1.   

    form1 BorderIcons 把最大化设成false
      

  2.   

    private
    procedure WMPosChange(var Message: TWMWINDOWPOSCHANGING);
    message WM_WINDOWPOSCHANGING;procedure Tform1.WMPosChange(var Message: TWMWINDOWPOSCHANGING);
    begin
    PWindowPos(TMessage(Message).lParam).Flags :=
    PWindowPos(TMessage(Message).lParam).Flags or
    SWP_NOMOVE or SWP_NOSIZE;
    end; 
    阻止用户移动窗体或改变它的大小
      

  3.   

     borderIcons的 bimaximze属性改为 false
      

  4.   

    borderIcons的 bimaximze属性改为 false  
    就是这个啊 
    只是设置成false后 要编译的时候才能看出来
      

  5.   

    borderIcons的 bimaximze属性改为 false 只是将最大化按钮禁用而已。
      

  6.   

    Windows 没有 Api 能够完成这样的操作,所以 delphi 不可以(其它语言也不可以)。
    只能参考 10L 的做法。
      

  7.   

    最大的不要了,最小化留着干嘛? Dialog 吧。
      

  8.   

    VCLSKIN.v4.11
    用这个控件能去掉即不显示最大化按钮,不知楼主能不能用第三方控件
      

  9.   


    unit Unit1;interface
     uses
    SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,Forms, Dialogs, Buttons, DdeMan, StdCtrls;
    type
      TTitleBtnForm = class(TForm)
        Button1: TButton;
        procedure FormResize(Sender: TObject);
      private
      TitleButton : TRect;procedure DrawTitleButton;{Paint-related messages}procedure WMSetText(var Msg : TWMSetText); message WM_SETTEXT;procedure WMNCPaint(var Msg : TWMNCPaint); message WM_NCPAINT;procedure WMNCActivate(var Msg : TWMNCActivate); message WM_NCACTIVATE;{Mouse down-related messages}procedure WMNCHitTest(var Msg : TWMNCHitTest); message WM_NCHITTEST;procedure WMNCLButtonDown(var Msg : TWMNCLButtonDown); message WM_NCLBUTTONDOWN;function GetVerInfo : DWORD;
        { Private declarations }
      public
        { Public declarations }
      end;var
      TitleBtnForm: TTitleBtnForm;
      consthtTitleBtn = htSizeLast + 1;implementation{$R *.dfm}
    procedure TTitleBtnForm.DrawTitleButton;varbmap : TBitmap; {Bitmap to be drawn - 16 X 16 : 16 Colors}XFrame, {X and Y size of Sizeable area of Frame}YFrame,XTtlBit, {X and Y size of Bitmaps in caption}YTtlBit : Integer;begin{Get size of form frame and bitmaps in title bar}XFrame := GetSystemMetrics(SM_CXFRAME);YFrame := GetSystemMetrics(SM_CYFRAME);XTtlBit := GetSystemMetrics(SM_CXSIZE);YTtlBit := GetSystemMetrics(SM_CYSIZE);{$IFNDEF WIN32}TitleButton := Bounds(Width - (3 * XTtlBit) - ((XTtlBit div 2) - 2),YFrame - 1,XTtlBit + 2,YTtlBit + 2);{$ELSE} {Delphi 2.0 positioning}if (GetVerInfo = VER_PLATFORM_WIN32_NT) thenTitleButton := Bounds(Width - (3 * XTtlBit) - ((XTtlBit div 2) - 2),YFrame - 1,XTtlBit + 2,YTtlBit + 2)elseTitleButton := Bounds(Width - XFrame - 4*XTtlBit + 2,XFrame + 2,XTtlBit + 2,YTtlBit + 2);{$ENDIF}Canvas.Handle := GetWindowDC(Self.Handle); {Get Device context for drawing}try{Draw a button face on the TRect}DrawButtonFace(Canvas, TitleButton, 1, bsAutoDetect, False, False, False);bmap := TBitmap.Create;bmap.LoadFromFile('c:\aaa.bmp');with TitleButton do{$IFNDEF WIN32}Canvas.Draw(Left + 2, Top + 2, bmap);{$ELSE}if (GetVerInfo = VER_PLATFORM_WIN32_NT) thenCanvas.Draw(Left + 2, Top + 2, bmap)elseCanvas.StretchDraw(TitleButton, bmap);{$ENDIF}finallyReleaseDC(Self.Handle, Canvas.Handle);//bmap.Free;Canvas.Handle := 0;end;end;{Paint triggering events}procedure TTitleBtnForm.WMNCActivate(var Msg : TWMNCActivate);beginInherited;DrawTitleButton;end;procedure TTitleBtnForm.FormResize(Sender: TObject);beginPerform(WM_NCACTIVATE, Word(Active), 0);end;{Painting events}procedure TTitleBtnForm.WMNCPaint(var Msg : TWMNCPaint);beginInherited;DrawTitleButton;end;procedure TTitleBtnForm.WMSetText(var Msg : TWMSetText);beginInherited;DrawTitleButton;end;{Mouse-related procedures}procedure TTitleBtnForm.WMNCHitTest(var Msg : TWMNCHitTest);beginInherited;{Check to see if the mouse was clicked in the area of the button}with Msg doif PtInRect(TitleButton, Point(XPos - Left, YPos - Top)) thenResult := htTitleBtn;end;procedure TTitleBtnForm.WMNCLButtonDown(var Msg : TWMNCLButtonDown);begininherited;if (Msg.HitTest = htTitleBtn) thenShowMessage('You pressed the new button');end;function TTitleBtnForm.GetVerInfo : DWORD;varverInfo : TOSVERSIONINFO;beginresult:=0;verInfo.dwOSVersionInfoSize := SizeOf(TOSVersionInfo);if GetVersionEx(verInfo) thenResult := verInfo.dwPlatformID;{Returns:VER_PLATFORM_WIN32s Win32s on Windows 3.1VER_PLATFORM_WIN32_WINDOWS Win32 on Windows 95VER_PLATFORM_WIN32_NT Windows NT }end;end.转一个自绘按钮的代码
    效果还行,有缺点,希望高手完善一下