ToolStripButton.AutoToolTip 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置一个值,该值指示 ToolTip 上显示的 ToolStripButton 是默认文本还是自定义文本。
public:
property bool AutoToolTip { bool get(); void set(bool value); };
public bool AutoToolTip { get; set; }
member this.AutoToolTip : bool with get, set
Public Property AutoToolTip As Boolean
属性值
如果显示的是默认 ToolTip 文本,则为 true
,否则为 false
。 默认值为 true
。
示例
下面的代码示例关闭自定义ToolStripButtonToolTipText的自动ToolTip文本。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
namespace WindowsApplication7
{
public class Form1 : Form
{
private ToolStripButton toolStripButton1;
private ToolStrip toolStrip1;
public Form1()
{
InitializeComponent();
}
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.Run(new Form1());
}
private void InitializeComponent()
{
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
this.toolStripButton1 = new System.Windows.Forms.ToolStripButton();
this.toolStrip1.SuspendLayout();
this.SuspendLayout();
//
// toolStrip1
//
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripButton1});
this.toolStrip1.Location = new System.Drawing.Point(0, 0);
this.toolStrip1.Name = "toolStrip1";
this.toolStrip1.TabIndex = 0;
this.toolStrip1.Text = "toolStrip1";
//
// toolStripButton1
this.toolStripButton1.AutoToolTip = false;
this.toolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
this.toolStripButton1.Name = "toolStripButton1";
this.toolStripButton1.Text = "Button1";
this.toolStripButton1.ToolTipText = "ToolTip for Button1.";
// Form1
//
this.ClientSize = new System.Drawing.Size(292, 273);
this.Controls.Add(this.toolStrip1);
this.Name = "Form1";
this.toolStrip1.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
}
}
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Windows.Forms
Public Class Form1
Inherits Form
Private toolStripButton1 As ToolStripButton
Private toolStrip1 As ToolStrip
Public Sub New()
InitializeComponent()
End Sub
<STAThread()> _
Shared Sub Main()
Application.EnableVisualStyles()
Application.Run(New Form1())
End Sub
Private Sub InitializeComponent()
Me.toolStrip1 = New System.Windows.Forms.ToolStrip()
Me.toolStripButton1 = New System.Windows.Forms.ToolStripButton()
Me.toolStrip1.SuspendLayout()
Me.SuspendLayout()
'
' toolStrip1
'
Me.toolStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.toolStripButton1})
Me.toolStrip1.Location = New System.Drawing.Point(0, 0)
Me.toolStrip1.Name = "toolStrip1"
Me.toolStrip1.TabIndex = 0
Me.toolStrip1.Text = "toolStrip1"
'
' toolStripButton1
Me.toolStripButton1.AutoToolTip = False
Me.toolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text
Me.toolStripButton1.Name = "toolStripButton1"
Me.toolStripButton1.Text = "Button1"
Me.toolStripButton1.ToolTipText = "ToolTip for Button1."
' Form1
'
Me.ClientSize = New System.Drawing.Size(292, 273)
Me.Controls.Add(toolStrip1)
Me.Name = "Form1"
Me.toolStrip1.ResumeLayout(False)
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
End Class
注解
将AutoToolTip属性设置为false
在 . ToolStripItem上显示自定义ToolTipText属性。