ToolTip.ShowAlways Свойство
Определение
Важно!
Некоторые сведения относятся к предварительной версии продукта, в которую до выпуска могут быть внесены существенные изменения. Майкрософт не предоставляет никаких гарантий, явных или подразумеваемых, относительно приведенных здесь сведений.
Возвращает или задает значение, указывающее, отображается ли окно подсказки, даже если его родительский элемент управления не активен.
public:
property bool ShowAlways { bool get(); void set(bool value); };
public bool ShowAlways { get; set; }
member this.ShowAlways : bool with get, set
Public Property ShowAlways As Boolean
Значение свойства
true Значение , если подсказка всегда отображается; falseв противном случае . Значение по умолчанию — false.
Примеры
В следующем примере кода создается экземпляр класса и связывается экземпляр ToolTip с Form созданным экземпляром. Затем код инициализирует свойства AutoPopDelayзадержки и InitialDelayReshowDelay. Кроме того, экземпляр ToolTip класса задает ShowAlways свойство для true включения отображения текста подсказки независимо от того, активна ли форма. Наконец, в примере сопоставляется текст подсказки с двумя элементами управления в форме, a Button и a CheckBox. В примере кода требуется, чтобы метод, определенный в примере, находится в пределах Form элемента управления с именем button1 и CheckBox именем checkBox1элемента управления, а метод вызывается из конструктораForm.Button
// This example assumes that the Form_Load event handling method
// is connected to the Load event of the form.
void Form1_Load( Object^ sender, System::EventArgs^ e )
{
// Create the ToolTip and associate with the Form container.
ToolTip^ toolTip1 = gcnew ToolTip;
// Set up the delays for the ToolTip.
toolTip1->AutoPopDelay = 5000;
toolTip1->InitialDelay = 1000;
toolTip1->ReshowDelay = 500;
// Force the ToolTip text to be displayed whether or not the form is active.
toolTip1->ShowAlways = true;
// Set up the ToolTip text for the Button and Checkbox.
toolTip1->SetToolTip( this->button1, "My button1" );
toolTip1->SetToolTip( this->checkBox1, "My checkBox1" );
}
// This example assumes that the Form_Load event handling method
// is connected to the Load event of the form.
private void Form1_Load(object sender, System.EventArgs e)
{
// Create the ToolTip and associate with the Form container.
ToolTip toolTip1 = new ToolTip();
// Set up the delays for the ToolTip.
toolTip1.AutoPopDelay = 5000;
toolTip1.InitialDelay = 1000;
toolTip1.ReshowDelay = 500;
// Force the ToolTip text to be displayed whether or not the form is active.
toolTip1.ShowAlways = true;
// Set up the ToolTip text for the Button and Checkbox.
toolTip1.SetToolTip(this.button1, "My button1");
toolTip1.SetToolTip(this.checkBox1, "My checkBox1");
}
' This example assumes that the Form_Load event handling method
' is connected to the Load event of the form.
Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles MyBase.Load
' Create the ToolTip and associate with the Form container.
Dim toolTip1 As New ToolTip()
' Set up the delays for the ToolTip.
toolTip1.AutoPopDelay = 5000
toolTip1.InitialDelay = 1000
toolTip1.ReshowDelay = 500
' Force the ToolTip text to be displayed whether or not the form is active.
toolTip1.ShowAlways = True
' Set up the ToolTip text for the Button and Checkbox.
toolTip1.SetToolTip(Me.button1, "My button1")
toolTip1.SetToolTip(Me.checkBox1, "My checkBox1")
End Sub
Комментарии
ShowAlways С помощью свойства можно отобразить окно подсказки, даже если контейнер неактивенToolTip. Эту функцию можно использовать в приложении без режима, чтобы включить отображение окон подсказки независимо от того, какое окно без режима активно. Эта функция также полезна, если вы хотите создать элемент управления с помощью элемента UserControlуправления, который содержит ряд элементов управления в нем, в которых отображаются окна подсказки. Так как часто UserControl активное окно в форме не является активным, присвойте этому свойству возможность true отображать элементы управления в UserControl окнах подсказки в любое время.