Form.ShowWithoutActivation Form.ShowWithoutActivation Form.ShowWithoutActivation Form.ShowWithoutActivation Property


获取一个值,该值指示显示窗口时是否激活它。Gets a value indicating whether the window will be activated when it is shown.

 virtual property bool ShowWithoutActivation { bool get(); };
protected virtual bool ShowWithoutActivation { get; }
member this.ShowWithoutActivation : bool
Protected Overridable ReadOnly Property ShowWithoutActivation As Boolean


如果显示窗口时不将其激活,则为 true;否则为 falsetrue if the window will not be activated when it is shown; otherwise, false. 默认值为 falseThe default is false.


如果要显示顶级窗口,但不希望通过从当前窗口中获取输入焦点来中断用户的工作,请使用此属性。Use this property if you want to show a top-level window, but don't want to interrupt a user's work by taking the input focus away from the current window. 这可能是一个信息性弹出窗口或浮动窗口,如画图应用程序中的工具面板。This can be an informational pop-up window or a floating window, such as a Tools palette in the Paint application.

由于此属性是只读的,因此您只能通过在您自己的窗体中重写 ShowWithoutActivation 并对其进行编程以返回 true 来更改其值。Because this property is read-only, you can only change its value by overriding ShowWithoutActivation in your own form, and programming it to return true.

如果非激活的窗口需要使用 UI 控件,则应考虑使用 ToolStrip 控件,如 @no__t。If your non-activated window needs to use UI controls, you should consider using the ToolStrip controls, such as ToolStripDropDown. 这些控件是无窗口的,并且在选定时不会导致窗口激活。These controls are windowless, and will not cause a window to activate when they are selected.