我利用FindWindowEx 查找到了Button 的 Handle 我用EnableWindow(Handle,True); 想让Enable为false 的按键变为Enable为true 如果Button的类是TButton 这种操作是没有问题的但是如果Button的类是TRzButton 这种操作不起作用如果使用SendMessage 改变TRzButton的Caption 是起作用的.想请问这是什么原因,为什么Enable 改变不过来? 有其它的办法吗? 非常感谢!
解决方案 »
- 一条sql语句
- 大家帮帮忙吧 ?
- 打印的时候前面一排相同的就不打印 100分,实现了马上结
- 编译错误:不同版本的编译
- DELPHI非常非常非常简单的问题
- 一关于JOIN问题?
- 兄弟们好,数据类型转换的问题:从ComboBox1控件中接受到的变量insert到SQL数据库表中的int字段
- 求助解除被软件屏蔽了的屏保问题!
- 下面的存储过程怎么写啊?
- Handle := LoadBitmap(0, PChar(32759));这段代码是什么意思?
- 线程函数能不能定义2个以上参数用CreateThread函数来传递啊
- 我会点delhi 想学去北大青鸟系统学下软件开发,可是他们不教delhi,教.net,那我会点delphi基础不是白学了吗?
程序是有设计逻辑和业务逻辑的,不要随意去改变,否则得到的结果将会与本意相违背.
顶了!
TRzButton 是有Handle 的,要不然怎么可以更改Caption 呢?
begin
if not Enabled and (Parent <> nil) then
RemoveFocus( False );
if HandleAllocated and not ( csDesigning in ComponentState ) then
EnableWindow( Handle, Enabled );
Invalidate;
end;
难道其它就没有什么办法了吗?
现在有点空闲时间,所以就研究一下WIN API
那你再试试这个:PostMessage(按扭句柄,WM_KEYDOWN,VK_RETURN,0);//在该句柄上按回车键
看过源码了,里面有一段 procedure TRzCustomButton.CMEnabledChanged( var Msg: TMessage );
begin
if not Enabled and (Parent <> nil) then
RemoveFocus( False );
if HandleAllocated and not ( csDesigning in ComponentState ) then
EnableWindow( Handle, Enabled );
Invalidate;
end; 通过这个CM消息找到它处理的消息编号,再试试吧。