Bagikan melalui


ToolTip.ShowAlways Properti

Definisi

Mendapatkan atau menetapkan nilai yang menunjukkan apakah jendela TipsAlat ditampilkan, bahkan ketika kontrol induknya tidak aktif.

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

Nilai Properti

true jika TipsAlat selalu ditampilkan; jika tidak, false. Defaultnya adalah false.

Contoh

Contoh kode berikut membuat instans ToolTip kelas dan mengaitkan instans dengan Form instans yang dibuat di dalamnya. Kode kemudian menginisialisasi properti AutoPopDelaypenundaan , , InitialDelaydan ReshowDelay. Selain itu, instans ToolTipShowAlways kelas mengatur properti untuk true mengaktifkan teks TipsAlat yang akan ditampilkan terlepas dari apakah formulir aktif. Terakhir, contoh mengaitkan teks TipsAlat dengan dua kontrol pada formulir, Button dan CheckBox. Contoh kode mengharuskan metode yang ditentukan dalam contoh terletak di dalam Form yang berisi Button kontrol bernama button1 dan CheckBox kontrol bernama checkBox1, dan bahwa metode dipanggil dari konstruktor 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

Keterangan

ShowAlways Dengan properti , Anda dapat menampilkan jendela TipsAlat bahkan ketika kontainer ToolTip tidak aktif. Anda dapat menggunakan fitur ini dalam aplikasi jendela tanpa mode untuk mengaktifkan jendela ToolTip untuk ditampilkan terlepas dari jendela tanpa mode mana yang aktif. Fitur ini juga berguna ketika Anda ingin membuat kontrol dengan menggunakan UserControl, yang berisi sejumlah kontrol di dalamnya yang menampilkan jendela ToolTip. UserControl Karena seringkali bukan jendela aktif pada formulir, atur properti ini untuk true mengaktifkan kontrol dalam UserControl jendela ToolTip untuk ditampilkan kapan saja.

Berlaku untuk

Lihat juga