SpeedButton设置Flat属性为TRUE时,控件未获取焦点时,不显示边框线;只有ONMouseMove时,才显示边框线。我还是喜欢有边框线的透明的状态。想法从TSPeedButton类覆盖它的一些方法以达到我的目的,试了几次不成功。请帮我看看应重写哪些方法才行?
解决方案 »
- 用memo预览带有密码的word问题
- 谁有用过ics组件
- delphi菜鸟问题~!请热心大蛱帮助~!!!
- indy udp怎么不能在win98里收到数据?
- 高手请进 ----在线给分
- a:=AnsiResemblesText(self.Edit1.Text,self.Edit2.Text);//提示错误:Error] Unit1.pas(32): Undeclared identifier: 'AnsiResemblesText
- 关于DbGrid的问题。
- 一个数据库问题,关于sql语句的,在线等待啊!
- 关于调用DOS命令
- 查找的实现
- 问个控件简单问题
- 界面编程:如何作一个类似Windows资源管理器主界面?
//复制如下代码到窗体上,注意不要复制注释~~object Bevel1: TBevel
Left = 104
Top = 80
Width = 23
Height = 22
Style = bsRaised
end
object SpeedButton1: TSpeedButton
Left = 104
Top = 80
Width = 23
Height = 22
Flat = True
end
unit MySpeedButton;interfaceuses
SysUtils, Classes, Controls, Buttons, Graphics, Messages;type
TMySpeedButton = class(TSpeedButton)
private
{ Private declarations }
protected
procedure Paint; override;
public
{ Public declarations }
published
{ Published declarations }
end;procedure Register;implementationprocedure Register;
begin
RegisterComponents('Samples', [TMySpeedButton]);
end;{ TMySpeedButton }procedure TMySpeedButton.Paint;
begin
inherited;
self.Perform(CM_MOUSEENTER,0,0);
end;end.
CareYouOnly(只在乎你)方法可行,但是却不能正常用cm_mouseenter消息了。最好的方法是修改paint,你可以重载此过程,也可以直接在TSpeedButton.Paint修改。
if (FState in [bsDown, bsExclusive]) or
(FMouseInControl and (FState <> bsDisabled)) or
(csDesigning in ComponentState) then改成
if (FState in [bsDown, bsExclusive]) or
(FState <> bsDisabled) or
(csDesigning in ComponentState) then
就达到你的目的了。