起步软件技术论坛-X3

 找回密码
 立即注册
搜索
查看: 184|回复: 8

[结贴]SpeedButton的显示

[复制链接]
发表于 2009-8-28 15:26:57 | 显示全部楼层 |阅读模式
如图,我在界面放了30个SpeedButton,设置图片

现在问题是鼠标快速划过再划走的时候,SpeedButton状态还是凸起,没有变回来

有什么解决的方法?
或者能让它鼠标移动的时候没有变化

未命名.jpg

8.26 KB, 下载次数: 113

回复

使用道具 举报

发表于 2009-8-28 15:33:24 | 显示全部楼层
取消勾选: Flat
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-8-28 15:37:00 | 显示全部楼层
取消了就不能透明了呀
回复 支持 反对

使用道具 举报

发表于 2009-8-28 15:44:26 | 显示全部楼层
OnMouseMove事件中自己加代码处理一下看看。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-8-28 15:54:40 | 显示全部楼层
不知道怎么写 :confused:
回复 支持 反对

使用道具 举报

发表于 2009-8-28 16:04:03 | 显示全部楼层
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-8-28 16:51:50 | 显示全部楼层
解决了,谢谢
回复 支持 反对

使用道具 举报

发表于 2009-8-28 16:52:52 | 显示全部楼层
恭喜,分享下吧。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-8-28 17:22:45 | 显示全部楼层
所有控件调用下面这个
procedure TMainForm.SpeedButton21MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
Var
i:Integer;
begin
  TSpeedButton(Sender).Flat:=False;
  with  pnlDesktopTreeView do
  begin
  for i:=0 to ControlCount-1 do
  begin
  if  Controls is TSpeedButton  then //用is来判断类型
      if  TSpeedButton(Sender).Name<>TSpeedButton(Controls).Name then
  TSpeedButton(Controls).Flat:=True;
  end;
  end;
end;
在它的容器上也写上
procedure TMainForm.pnlDesktopTreeViewMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
Var
i:Integer;
begin
  with  pnlDesktopTreeView do
  begin
  for i:=0 to ControlCount-1 do
  begin
  if  Controls is TSpeedButton  then //用is来判断类型
      TSpeedButton(Controls).Flat:=True;
  end;
  end;
end;

:confused:  感觉有点笨拙

其实我想试下重载不要它写的MouseMove事件,但不会写

TSpeedButton = class(TGraphicControl)
protected
procedure MouseDown(Button: TMouseButton; Shift: Business.System.TShiftState; X: Longint; Y: Longint); override;
public
end;

procedure TSpeedButton .MouseDown(Button: TMouseButton; Shift: Business.System.TShiftState; X: Longint; Y: Longint);
begin
//
end;
但一运行就出错,请问怎么改
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Justep Inc.

GMT+8, 2025-7-17 02:55 , Processed in 0.044950 second(s), 18 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表