小女子高分求救!!!窗口右上角最大最小化按钮如何融合??

malayanxiaorong 2007-08-31 04:54:40
我用delphi开发的应用程序,新建一个窗口,窗口本身有“最大最小关闭”按钮;然而因界面风格要求,需要换上一套新的“最大最小关闭”按钮,所以现在的问题是,一运行就出现两套图标,非常别扭;如果去掉窗口本身那套,则窗口没有右键功能;所以,如何实现,这两套按钮的融合,显示的是那套统一风格的“最大最小关闭”按钮,同时又有右键功能。
...全文
272 19 打赏 收藏 转发到动态 举报
写回复
用AI写文章
19 条回复
切换为时间正序
请发表友善的回复…
发表回复
HDZC 2010-06-01
  • 打赏
  • 举报
回复
问题解决了
应该有的
shumadong 2010-06-01
  • 打赏
  • 举报
回复
学习 学习
nasucatotoro 2010-05-18
  • 打赏
  • 举报
回复
算了吧,我发现就算连源代码等整套方案都给出来了,都不会得到技术分!
到目前为止,都没见过说有哪位完整回复了能解决问题的方案,而得到回报!
yybt8743 2010-04-07
  • 打赏
  • 举报
回复
不用FORM单元 从TWinControl直接继承 不过要对API比较熟悉
zzwu 2009-03-03
  • 打赏
  • 举报
回复
1. 无边框窗体也可以在FormCreate中实现,如:
procedure TForm1.FormCreate(Sender: TObject);
begin
borderstyle:=bsnone; //不用标题行
end;

2. 响应右键,可以利用MouseDown事件,例如,
假设你用speedButton1模拟最小化按钮,则响应
右击最小化按钮的程序形式为:

procedure TForm1.SpeedButton1MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if button=mbright then
begin
showmessage('to minimize the window.');
end;
end;

3.以下是一个简单化了的模拟程序,

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, ToolWin, Buttons, Menus;

type
TForm1 = class(TForm)
CoolBar1: TCoolBar;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
procedure FormCreate(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure SpeedButton3Click(Sender: TObject);
procedure SpeedButton1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure SpeedButton2MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure SpeedButton3MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
width:=600;
height:=400;
align:=alNone;
position:=poScreenCenter;
BorderStyle:=bsnone; //不用标题行
speedbutton1.left:=width-3*speedbutton1.width-10;
speedbutton2.left:=width-2*speedbutton1.width-10;
speedbutton3.left:=width-speedbutton1.width-10;
speedbutton1.Caption:='-';
speedbutton2.Caption:='口';
speedbutton3.Caption:='X';
end;

//最小化窗体
procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
Form1.WindowState:=wsMinimized;//application.Minimize;
end;

//右击最小化按钮
procedure TForm1.SpeedButton1MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if button=mbright then
begin
showmessage('to minimize the window.');
end;
end;

//最大化窗体
procedure TForm1.SpeedButton2Click(Sender: TObject);
begin
Form1.WindowState:=wsMaximized
end;

//右击最大化按钮
procedure TForm1.SpeedButton2MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if button=mbright then
begin
showmessage('to maximize the window.');
end;
end;

//退出系统
procedure TForm1.SpeedButton3Click(Sender: TObject);
begin
close
end;

//右击退出系统按钮
procedure TForm1.SpeedButton3MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if button=mbright then
begin
showmessage('to close the window.');
end;
end;

end.

//当然,程序还有进一步改进的地方,


jacky81314 2009-03-02
  • 打赏
  • 举报
回复
使用无边框窗体,在窗体属性里borderstyle设成none,然后你再你自己的最小池大化等按钮,自己增加事件写代码,就可以了
wulingyigu1 2009-01-21
  • 打赏
  • 举报
回复
使用无边框窗体
wulingyigu1 2009-01-21
  • 打赏
  • 举报
回复
使用无边框窗体
xfzhuhan 2009-01-13
  • 打赏
  • 举报
回复
学习
墨梅无痕 2008-12-23
  • 打赏
  • 举报
回复
好久好久没看到有人提这种问题了!!
怀念旧时光……
ssssss 2008-12-03
  • 打赏
  • 举报
回复
回帖是一种美德!传说每天回帖即可获得 10 分可用分!
shen_shen1981 2008-03-10
  • 打赏
  • 举报
回复
既然你写出新的最大最小的一套按纽 添加个右键还是问题吗
jacklee_888 2008-02-04
  • 打赏
  • 举报
回复
是的﹐通常情況就是自己控制比較方便﹐這種控制功能在WWW.DELPHIBOX.COM上有討論
cloudgamer 2008-01-14
  • 打赏
  • 举报
回复
学习
liuhengwinner 2008-01-11
  • 打赏
  • 举报
回复
设计个无边框,自己控制,我就是那么做的!
panzi667 2007-09-16
  • 打赏
  • 举报
回复
学习中~帮你顶
jie156 2007-09-08
  • 打赏
  • 举报
回复
就是无边框的窗体,插进自己的界面图,为标题栏增加无边框拖动代码,为大小关闭钮增加相应代码

你可以加群:6324513 大家讨论讨论
godgreat 2007-09-04
  • 打赏
  • 举报
回复
沙发,帮忙顶

1,979

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 其他语言讨论
社区管理员
  • 其他语言社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧