TButton的 BN_SETFOCUS/BN_KILLFOCUS 消息 TButton的 BN_SETFOCUS/BN_KILLFOCUS 分别在什么时候触发?我的程序BN_SETFOCUS压根不触发, BN_KILLFOCUS 在得到焦点是触发,这是怎么回事 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 TO: TommyTong(童童--青锋软件工作室)我强烈关注!!^_^ 要收到BN_SETFOCUS, BN_KILLFOCUS,需要TButton的Style含有BS_NOTIFY以下刚试过unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, TestButton;type TForm1 = class(TForm) Memo1: TMemo; Button1: TButton; Button2: TButton; Button3: TButton; Button4: TButton; procedure Button4Click(Sender: TObject); private { Private declarations } procedure WMCommand(var msg: TMessage); message WM_COMMAND; public { Public declarations } end;var Form1: TForm1;implementation{$R *.dfm}procedure TForm1.WMCommand(var msg: TMessage);begin if Msg.WParamHi = BN_SETFOCUS then Memo1.Lines.Add(FindControl(msg.LParam).Name + ': BN_SETFOCUS') else if Msg.WParamHi = BN_KILLFOCUS then Memo1.Lines.Add(FindControl(msg.LParam).Name + ': BN_KILLFOCUS') else Inherited;end;procedure TForm1.Button4Click(Sender: TObject);var i: Integer;begin for i := 0 to ComponentCount - 1 do if Components[i] is TButton then SetWindowLong(TButton(Components[i]).Handle, GWL_STYLE, GetWindowLong(Button1.Handle, GWL_STYLE) or BS_NOTIFY); end;end. 学习中;多谢 xzgyb(老达摩) 兄. 这本书的随书光盘哪位有? delphi 窗口问题 如何得到父窗体? ▲▲CodeGurad跟踪出来的问题▲▲ 还是2005~~~ paradox的数据库如何进行备份和复制? 在线等待 请教:关于—Storedproc调用存储函数时的问题——非常简单!!!在线等!! 如何在我自制的表格控件里加入滚动条,我的控件是从TCustomControl继承下来的? 帮我把c++译成delphi代码 ACCESS能做应用程序,是! 三层结构中的问题,欢迎大家来讨论. 你吸烟吗?(有关程序员的健康调查)
我强烈关注!!
^_^
以下刚试过
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, TestButton;type
TForm1 = class(TForm)
Memo1: TMemo;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
procedure Button4Click(Sender: TObject);
private
{ Private declarations }
procedure WMCommand(var msg: TMessage); message WM_COMMAND;
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}
procedure TForm1.WMCommand(var msg: TMessage);
begin
if Msg.WParamHi = BN_SETFOCUS then
Memo1.Lines.Add(FindControl(msg.LParam).Name + ': BN_SETFOCUS')
else if Msg.WParamHi = BN_KILLFOCUS then
Memo1.Lines.Add(FindControl(msg.LParam).Name + ': BN_KILLFOCUS')
else Inherited;
end;procedure TForm1.Button4Click(Sender: TObject);
var
i: Integer;
begin
for i := 0 to ComponentCount - 1 do
if Components[i] is TButton then
SetWindowLong(TButton(Components[i]).Handle, GWL_STYLE, GetWindowLong(Button1.Handle, GWL_STYLE) or BS_NOTIFY);
end;end.
多谢 xzgyb(老达摩) 兄.