Form.ShowInTaskbar Form.ShowInTaskbar Form.ShowInTaskbar Form.ShowInTaskbar Property

定义

获取或设置一个值,该值指示是否在 Windows 任务栏中显示窗体。Gets or sets a value indicating whether the form is displayed in the Windows taskbar.

public:
 property bool ShowInTaskbar { bool get(); void set(bool value); };
public bool ShowInTaskbar { get; set; }
member this.ShowInTaskbar : bool with get, set
Public Property ShowInTaskbar As Boolean

属性值

如果为 true,则运行时在 Windows 任务栏中显示窗体;否则,为 falsetrue to display the form in the Windows taskbar at run time; otherwise, false. 默认值为 trueThe default is true.

示例

下面的代码示例演示如何使用ShowInTaskbar属性以使框的对话框不显示在 Windows 任务栏中。The following code example demonstrates how to use the ShowInTaskbar property to make a dialog box that is not displayed in the Windows taskbar.

private:
   void ShowInTaskBarEx()
   {
      Form^ myForm = gcnew Form;
      myForm->Text = "My Form";
      myForm->SetBounds( 10, 10, 200, 200 );
      myForm->FormBorderStyle = ::FormBorderStyle::FixedDialog;
      myForm->MinimizeBox = false;
      myForm->MaximizeBox = false;

      // Do not allow form to be displayed in taskbar.
      myForm->ShowInTaskbar = false;
      myForm->ShowDialog();
   }
private void ShowInTaskBarEx()
{
	Form myForm = new Form();
	myForm.Text = "My Form";
	myForm.SetBounds(10,10,200,200);
	myForm.FormBorderStyle = FormBorderStyle.FixedDialog;
	myForm.MinimizeBox = false;
	myForm.MaximizeBox = false;
	// Do not allow form to be displayed in taskbar.
	myForm.ShowInTaskbar = false;
	myForm.ShowDialog();
}
Private Sub ShowInTaskBarEx()
    Dim myForm As New Form()
    myForm.Text = "My Form"
    myForm.SetBounds(10, 10, 200, 200)
    myForm.FormBorderStyle = FormBorderStyle.FixedDialog
    myForm.MinimizeBox = False
    myForm.MaximizeBox = False
    ' Do not allow form to be displayed in taskbar.
    myForm.ShowInTaskbar = False
    myForm.ShowDialog()
End Sub

注解

如果另一个窗体中为父窗体,该父窗体不会显示在 Windows 任务栏中。If a form is parented within another form, the parented form is not displayed in the Windows taskbar.

此属性可用于防止用户选择通过 Windows 任务栏窗体。You can use this property to prevent users from selecting your form through the Windows taskbar. 例如,如果在应用程序中显示的查找和替换工具窗口,您可能想要防止该窗口被选中通过 Windows 任务栏,因为您将需要应用程序的主窗口和查找和替换工具窗口显示,以便适当地处理搜索。For example, if you display a Find and Replace tool window in your application, you might want to prevent that window from being selected through the Windows taskbar because you would need both the application's main window and the Find and Replace tool window displayed in order to process searches appropriately.

您通常希望创建一个具有窗体时使用此属性FixedToolWindow样式。You will often wish to use this property when creating a form with the FixedToolWindow style. 设置FixedToolWindow样式不单独保证该窗口不会出现在任务栏中。Setting the FixedToolWindow style does not alone guarantee that a window will not appear in the taskbar.

适用于