如何防止窗体在用户点击时被激活? [英] How to prevent form from being activated when the users clicks on it?
问题描述
所以,基本上我想要自动填充表单当用户单击时接收鼠标点击消息,但永远不会变为活动状态,因为它会导致主窗体中无法控制的第三方组件出现问题。
覆盖表单的CreateParams方法,并将扩展样式添加到WS_EX_NOACTIVATE样式。
procedure TForm1.CreateParams(var Params:TCreateParams);
开始
继承;
Params.WindowClass.ExStyle:= Params.WindowClass.ExStyle或WS_EX_NOACTIVATE;
结束
(内存中编写的代码,可能包含打字错误)
I have a main form and non-modal autocomplete form. How can I prevent the autocomplete form from being activated by the user, when the user clicks on the list in the autocomplete form?
So, basically I want the autocomplete form the receive the mouse click message when the users clicks, but to never become active, because it causes problems with a third-party component in the main form over which I have no control.
Override CreateParams method of your form and add WS_EX_NOACTIVATE style to the extended styles.
procedure TForm1.CreateParams(var Params: TCreateParams);
begin
inherited;
Params.WindowClass.ExStyle := Params.WindowClass.ExStyle or WS_EX_NOACTIVATE;
end;
(code written from memory, might contain typos)
这篇关于如何防止窗体在用户点击时被激活?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!