DrawToolTipEventArgs.AssociatedWindow Properti
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Mendapatkan jendela tempat ini ToolTip terikat.
public:
property System::Windows::Forms::IWin32Window ^ AssociatedWindow { System::Windows::Forms::IWin32Window ^ get(); };
public System.Windows.Forms.IWin32Window AssociatedWindow { get; }
public System.Windows.Forms.IWin32Window? AssociatedWindow { get; }
member this.AssociatedWindow : System.Windows.Forms.IWin32Window
Public ReadOnly Property AssociatedWindow As IWin32Window
Nilai Properti
Jendela yang memiliki ToolTip.
Contoh
Contoh kode berikut menunjukkan penggunaan anggota ini. Dalam contoh, penanganan aktivitas melaporkan kemunculan ToolTip.Draw peristiwa. Laporan ini membantu Anda mempelajari kapan peristiwa terjadi dan dapat membantu Anda dalam penelusuran kesalahan.
Untuk menjalankan kode contoh, tempelkan ke dalam proyek yang berisi instans jenis ToolTip bernama ToolTip1
. Kemudian pastikan bahwa penanganan aktivitas dikaitkan dengan peristiwa.ToolTip.Draw
private void ToolTip1_Draw(Object sender, DrawToolTipEventArgs e) {
System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "Graphics", e.Graphics );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "AssociatedWindow", e.AssociatedWindow );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "AssociatedControl", e.AssociatedControl );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Bounds", e.Bounds );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "ToolTipText", e.ToolTipText );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Font", e.Font );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "Draw Event" );
}
Private Sub ToolTip1_Draw(sender as Object, e as DrawToolTipEventArgs) _
Handles ToolTip1.Draw
Dim messageBoxVB as New System.Text.StringBuilder()
messageBoxVB.AppendFormat("{0} = {1}", "Graphics", e.Graphics)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "AssociatedWindow", e.AssociatedWindow)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "AssociatedControl", e.AssociatedControl)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "Bounds", e.Bounds)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "ToolTipText", e.ToolTipText)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "Font", e.Font)
messageBoxVB.AppendLine()
MessageBox.Show(messageBoxVB.ToString(),"Draw Event")
End Sub
Keterangan
Ketika jendela dimiliki oleh jendela lain, jendela yang dimiliki diminimalkan dan ditutup dengan jendela pemilik. Jendela yang dimiliki juga tidak pernah ditampilkan di belakang formulir pemiliknya. Di sini TipsAlat dimiliki oleh jendela Win32 asli yang AssociatedWindow diwakili oleh properti .