社区
Delphi
帖子详情
如何实现鼠标移动到一个button上就改变button.caption,移开后恢复原来的caption
jzbmoc
2003-05-07 04:22:52
如题
...全文
93
12
打赏
收藏
如何实现鼠标移动到一个button上就改变button.caption,移开后恢复原来的caption
如题
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
12 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
ad311500
2003-05-08
打赏
举报
回复
把bglong(阿笨)和BOZ的方法加起来使用是最好的方法
yzf111
2003-05-08
打赏
举报
回复
虽然用PANEL把BUTTON包起来了,但是如果button的LEFT=0时,MOUSE从BUTTON左边移出去时可能并不会触发PANEL的MOUSEOVER事件,这样会没问题吗,望各位大侠考虑一下。
jzbmoc
2003-05-07
打赏
举报
回复
right,用panel把button包起来,然后按照boz(波)兄的做法(这厮什么名字·!#¥·%),问题解决了。
gytyl
2003-05-07
打赏
举报
回复
procedure TForm1.Button1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
button1.caption:='新值'
end;
//其他button周围的
procedure TForm1.xxxxMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
button1.caption:='旧值'
end;
应该可以实现的。
bglong
2003-05-07
打赏
举报
回复
把button用一个其他的控件(比如panel)包起来就好了!!
ad311500
2003-05-07
打赏
举报
回复
同意BOZ
fhuibo
2003-05-07
打赏
举报
回复
同意boz
gexinmin2008
2003-05-07
打赏
举报
回复
看看事件触发顺序你就明白了.
yzf111
2003-05-07
打赏
举报
回复
to boz,难道周围所有的控件都要写上button1.caption:='旧值'吗,这样似乎不是办法吧
anaikh
2003-05-07
打赏
举报
回复
I agree with boz!
yhq2002
2003-05-07
打赏
举报
回复
我想是用ONenter和 onexit事件吧
boz
2003-05-07
打赏
举报
回复
procedure TForm1.Button1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
button1.caption:='新值'
end;
//其他button周围的
procedure TForm1.xxxxMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
button1.caption:='旧值'
end;
delphi计算器
用delphi做的计算器。unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Scr: TLabel;
Button
1: T
Button
;
Button
2: T
Button
;
Button
3: T
Button
;
Button
4: T
Button
;
Button
5: T
Button
;
Button
6: T
Button
;
Button
7: T
Button
;
Button
8: T
Button
;
Button
9: T
Button
;
Button
10: T
Button
;
Button
11: T
Button
;
Button
12: T
Button
;
Button
13: T
Button
;
Button
14: T
Button
;
Button
15: T
Button
;
Button
16: T
Button
;
Button
17: T
Button
;
Button
18: T
Button
;
Button
19: T
Button
;
Button
20: T
Button
; procedure
Button
1Click(Sender: TObject); procedure
Button
12Click(Sender: TObject); procedure FormCreate(Sender: TObject); procedure
Button
11Click(Sender: TObject); procedure
Button
13Click(Sender: TObject); procedure
Button
20Click(Sender: TObject); procedure
Button
19Click(Sender: TObject); procedure
Button
18Click(Sender: TObject); private { Private declarations } pnt,er,fb:boolean; fstnm:Extended; fb
caption
:string; public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.
Button
1Click(Sender: TObject); var temp:string; begin if er then exit; if pnt then scr.
Caption
:=scr.
Caption
+(sender as T
button
).
Caption
else if (scr.
Caption
='0.') or fb then begin scr.
Caption
:=(sender as T
button
).
caption
+'.'; fb:=false; end else begin temp:=scr.
Caption
; insert((sender as T
button
).
Caption
,temp,length(temp)); scr.
Caption
:=temp; end; end; procedure TForm1.
Button
12Click(Sender: TObject); var temp:string; begin if er then exit; if scr.
Caption
<>'0.' then if pos('-',scr.
Caption
)>0 then begin temp:=scr.
Caption
; delete(temp,1,1); scr.
Caption
:=temp; end else scr.
Caption
:='-'+scr.
Caption
; end; procedure TForm1.FormCreate(Sender: TObject); begin pnt:=false; fstnm:=0; fb:=false; fb
caption
:=''; er:=false; end; procedure TForm1.
Button
11Click(Sender: TObject); begin if er then exit; pnt:=true; end; procedure TForm1.
Button
13Click(Sender: TObject); begin if er then exit; if not fb then
button
20click(nil); if er then exit; fstnm:=strtofloat(scr.
Caption
); fb
caption
:=(sender as T
button
).
Caption
; fb:=true; pnt:=false; end; procedure TForm1.
Button
20Click(Sender: TObject); begin if er then exit; if fb
caption
='+' then begin scr.
Caption
:=floattostr(strtofloat(scr.
Caption
)+fstnm); end; if fb
caption
='-' then begin scr.
Caption
:=floattostr(fstnm-strtofloat(scr.
Caption
)); end; if fb
caption
='*' then begin scr.
Caption
:=floattostr(strtofloat(scr.
Caption
)*fstnm); end; if fb
caption
='/' then begin if scr.
Caption
<>'0.' then scr.
Caption
:=floattostr(fstnm/strtofloat(scr.
Caption
)) else begin scr.
Caption
:='zero divid error!'; er:=true; end; end; if pos('.',scr.
caption
)=0 then scr.
Caption
:=scr.
Caption
+'.'; fb:=true; pnt:=false; fb
caption
:=''; end; procedure TForm1.
Button
19Click(Sender: TObject); begin pnt:=false; fstnm:=0; fb:=false; fb
caption
:=''; er:=false; scr.
Caption
:='0.'; end; procedure TForm1.
Button
18Click(Sender: TObject); begin if er then exit; scr.
Caption
:='0.'; end; end.
lxc.rar_btncolor_
caption
button
_按钮 颜色
aDate : 值 Btn
Caption
:按钮
Caption
BtnColor: 按钮颜色 CanEdit:控件不能获得焦点 Enabled : 控件不能输入 HasTime :是否包宮.....
关于
button
caption
竖排
T
Button
类型:
Button
1.WordWrap := True;
Button
1.
Caption
:= '单击事件';这种情况则视宽度大小而定每行多少个字。
Button
1.
Caption
:= '单' + #13 + '击' + #13 + '事' + #13 + '件';这种情况则强制每行
一个
字TSpeed
Button
:没有WordWrap 属性,则需强制指定每行多少个字,如下Speed
Button
1.
Caption
:= '单' + #13 + '击' + #13 + '事' + #13 + '件
DevExpress.XtraGrid.GridControl GridView 根据条件动态
改变
RepositoryItem
Button
Edit 的
Caption
今天碰到一新的修改需求,在DevExpress.XtraGrid.Views.Grid.GridView界面中,根据当前的行的数据状态,
改变
RepositoryItem
Button
Edit的
Caption
数据,折腾了很久,要么 不起作用,要么包界面中的所有
Button
的
Caption
的都
改变
了 ,要么点击按钮后,按钮消失了,留下
一个
空白的单元格子在哪里。经过一番折腾和查阅各种资料,终于解决了
MFC
实现
当
鼠标
移动
到
button
按钮上时是显示一张图片,
移开
显示另外一张,点击是显示另外一张
编程中,经常要用到按钮控件,大部分情况下,文字按钮就OK了,但有时为了更好的效果,需要用到图形按钮。 在MFC中,应用CBitmap
Button
就可以
实现
图形按钮。CBitmap
Button
类继承自C
Button
类。你可以为图形按钮指定四张图片,分别对应按钮的四种不同状态: 正常显示(Up),
鼠标
按下(Down),获得焦点(Focused),不可用(Disabled)。 正常显示(Up)状态
Delphi
5,388
社区成员
262,730
社区内容
发帖
与我相关
我的任务
Delphi
Delphi 开发及应用
复制链接
扫一扫
分享
社区描述
Delphi 开发及应用
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章