TOleContainer 焦点问题
来源:互联网 发布:淘宝注册资金可以退吗 编辑:程序博客网 时间:2024/05/17 09:33
TOleContainer 是一个OLE容器,近日想用DELPHI嵌入EXCEL做报表,由于不想单独出现一个EXCEL窗口,自然想到用TOleContainer,但TOleContainer有一个缺陷,就是失去焦点后EXCEL窗口同时也变灰了,需要重新激活,“有问题,找GOOGLE”,总结了几个可以避免此问题的方法 :
1.将TOleContainer失去焦点前的界面保存下来,在TOleContainer失去焦点后,用一BITMAP覆盖在上面,以假乱真。
2.重新用ACTIVEX封装一遍TOleContainer,我没试验,不知道可行不可行。
3.就是在有TOleContainer同一窗体内不放置可以获得焦点的控件,这样TOleContainer就永远不会失去焦点,自然也就不会变灰,但只能对付一些简单的界面。
4.在TOleContainer 的ONEXIT事件里加入代码,重新激活TOleContainer的焦点,这个方法我没有试验,觉得有点土,而且在焦点失去后获得,肯定有一定的闪烁。
5.屏蔽TOleContainer的失去焦点消息,提供一个网上的代码,觉得这个方法还可以
重新继承一个
TOleContainerAc=class(TOleContainer)
private
FCannotDeactivate: Boolean;
procedure CMUIDeactivate(var Message: TMessage); message CM_UIDEACTIVATE;
published
property CannotDeactivate: Boolean read FCannotDeactivate write FCannotDeactivate;
end;
{ TOleContainerAc }
procedure TOleContainerAc.CMUIDeactivate(var Message: TMessage);
begin
if not CannotDeactivate then
inherited;
end;
这样,不需要失去焦点的时候只需设置 CannotDeactivate := True;
6.期待你的更好的解决方法 :)
- TOleContainer 焦点问题
- TOleContainer 焦点问题
- TOLEContainer部件
- 焦点问题
- 焦点问题
- Tolecontainer的简单应用
- 回车切换焦点问题
- textbox 获得焦点问题
- 文本框焦点问题
- OLE 焦点问题
- 窗口焦点问题
- treeview 保留焦点问题
- Kuix 焦点跳转问题
- updatepanel焦点问题
- QMenuBar焦点问题 (QTBUG18896)
- flex canvas焦点问题
- android 焦点问题
- android焦点问题
- javascript 定时器
- VC创建EXCEL图表
- 让SharePoint站点输出详细错误信息
- 在VC中编译、运行程序的小知识点
- 为网站制作漂亮的按钮
- TOleContainer 焦点问题
- 计算机启动过程
- javascript的arguments
- Serial Communications in Win32
- 網站收藏
- Cursor
- 饲料里添加“三聚”是中科院的专利
- 关注Game内嵌Flash UI
- 还为安装IIS发愁吗?全系列IIS自动安装程序倾囊奉送!--技术原理介绍及成品下载