请高手指点一二

解决方案 »

  1.   

    可以使用界面组件,skinengine等,还有AHM2000/WWW。51DELPHI。COM下载
      

  2.   

    这个是在窗体标题栏上显示按钮的,供参考:
    unit Unit1;interfaceuses
    Windows, Buttons, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;type
    TForm1 = class(TForm)
    procedure FormResize(Sender: TObject);
    private
    CaptionBtn : TRect;
    procedure DrawCaptButton;
    procedure WMNCPaint(var Msg : TWMNCPaint); message WM_NCPaint;
    procedure WMNCActivate(var Msg : TWMNCActivate); message WM_NCACTIVATE;
    procedure WMSetText(var Msg : TWMSetText); message WM_SETTEXT;
    procedure WMNCHitTest(var Msg : TWMNCHitTest); message WM_NCHITTEST;
    procedure WMNCLButtonDown(var Msg : TWMNCLButtonDown); message WM_NCLBUTTONDOWN;
    public
    { Public declarations }
    end;var
    Form1: TForm1;implementationconst
    htCaptionBtn = htSizeLast + 1;
    {$R *.DFM}procedure TForm1.DrawCaptButton;
    var
    xFrame,
    yFrame,
    xSize,
    ySize : Integer;
    R : TRect;
    begin
    //获取窗体的边框尺寸
    xFrame := GetSystemMetrics(SM_CXFRAME);
    yFrame := GetSystemMetrics(SM_CYFRAME);//获取标题按钮的尺寸
    xSize := GetSystemMetrics(SM_CXSIZE);
    ySize := GetSystemMetrics(SM_CYSIZE);//定义一个新的标题按钮(非系统按钮)
    CaptionBtn := Bounds(Width - xFrame - 5*xSize + 2,
    yFrame + 2, xSize + 2, ySize - 4);
    //获取窗体画布的句柄
    Canvas.Handle := GetWindowDC(Self.Handle);//定义画布的属性
    Canvas.Font.Name := '宋体';
    Canvas.Font.Color := clBlue;
    Canvas.Pen.Color := clYellow;
    Canvas.Brush.Color := clBtnFace;try
    //画按钮 
    DrawButtonFace(Canvas, CaptionBtn, 1, bsAutoDetect, False, False, False);
    //在按钮中定义一个范围用来输出按钮标题信息
    R := Bounds(Width - xFrame - 5 * xSize + 2,
    yFrame + 3, xSize +10, ySize - 7);
    with CaptionBtn do
    Canvas.TextRect(R, R.Left + 2, R.Top , '你好');
    finally
    ReleaseDC(Self.Handle, Canvas.Handle);
    Canvas.Handle := 0;
    end;
    end;
    //接收到Paint消息时重画按钮
    procedure TForm1.WMNCPaint(var Msg : TWMNCPaint);
    begin
    inherited;
    DrawCaptButton;
    end;
    //激活时重画
    procedure TForm1.WMNCActivate(var Msg : TWMNCActivate);
    begin
    inherited;
    DrawCaptButton;
    end;
    //接收到WM_SETTEXT消息时重画按钮
    procedure TForm1.WMSetText(var Msg : TWMSetText);
    begin
    inherited;
    DrawCaptButton;
    end;
    //捕获鼠标消息,检查是否按了按钮
    procedure TForm1.WMNCHitTest(var Msg : TWMNCHitTest);
    begin
    inherited;
    with Msg do
    if PtInRect(CaptionBtn, Point(XPos - Left, YPos - Top)) then
    Result := htCaptionBtn;
    end;
    //鼠标按下的相应操作,用户可添加各种代码,这里只显示一个对话框作例子
    procedure TForm1.WMNCLButtonDown(var Msg : TWMNCLButtonDown);
    begin
    inherited;
    if (Msg.HitTest = htCaptionBtn) then
    ShowMessage('你好,你按的是标题栏上的按钮!');
    end;//窗体改变大小时强制重画标题栏
    procedure TForm1.FormResize(Sender: TObject);
    begin
    //Force a redraw of caption bar if form is resized
    Perform(WM_NCACTIVATE, Word(Active), 0);
    end;end.