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задержки , InitialDelayи ReshowDelay. Кроме того, экземпляр класса задает свойству ToolTipShowAlways значение , true чтобы разрешить отображение текста подсказки независимо от того, активна ли форма. Наконец, в примере текст подсказки связывается с двумя элементами управления в форме: Button и CheckBox. В примере кода требуется, чтобы метод, определенный в примере, находился в Form объекте , который содержит Button элемент управления с именем button1 и CheckBox элемент управления с именем checkBox1, а метод вызывается из конструктора Form.

// 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 момент отображать окна всплывающих подсказок.

Применяется к

См. также раздел