Label.UseMnemonic Özellik
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
Denetimin özelliğindeki Text bir ve işareti karakterini (&) erişim anahtarı ön eki karakteri olarak yorumlayıp yorumlamadığını belirten bir değer alır veya ayarlar.
public:
property bool UseMnemonic { bool get(); void set(bool value); };
public bool UseMnemonic { get; set; }
member this.UseMnemonic : bool with get, set
Public Property UseMnemonic As Boolean
Özellik Değeri
true etiket ve işaretini görüntülemiyorsa ve görüntülenen metninde ve işaretinden sonraki karakterin altını çizerse ve altı çizili karakteri bir erişim anahtarı olarak kabul ederse; aksi takdirde, false ve işareti denetimin metninde görüntüleniyorsa. Varsayılan değer: true.
Örnekler
Aşağıdaki kod örneği, ve özellikleri kullanılarak üç boyutlu kenarlık ve görüntü görüntü içeren bir denetimin ImageListImageIndex nasıl oluşturulacağını Label gösterir. Denetimin ayrıca, belirtilen bir anımsatıcı karakteri olan bir resim yazısı da vardır. Örnek kod, denetimin görüntülendiği formda düzgün şekilde boyutlandırılmalarını Label sağlamak için ve PreferredWidth özelliklerini kullanırPreferredHeight. Bu örnek, bir ImageList öğesinin oluşturulmasını ve imageList1 olarak adlandırıldığını ve iki görüntü yüklemiş olmasını gerektirir. Örnek ayrıca kodun ad alanının koduna eklendiği bir formda System.Drawing olmasını gerektirir.
public:
void CreateMyLabel()
{
// Create an instance of a Label.
Label^ label1 = gcnew Label;
// Set the border to a three-dimensional border.
label1->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D;
// Set the ImageList to use for displaying an image.
label1->ImageList = imageList1;
// Use the second image in imageList1.
label1->ImageIndex = 1;
// Align the image to the top left corner.
label1->ImageAlign = ContentAlignment::TopLeft;
// Specify that the text can display mnemonic characters.
label1->UseMnemonic = true;
// Set the text of the control and specify a mnemonic character.
label1->Text = "First &Name:";
/* Set the size of the control based on the PreferredHeight and PreferredWidth values. */
label1->Size = System::Drawing::Size( label1->PreferredWidth, label1->PreferredHeight );
//...Code to add the control to the form...
}
public void CreateMyLabel()
{
// Create an instance of a Label.
Label label1 = new Label();
// Set the border to a three-dimensional border.
label1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
// Set the ImageList to use for displaying an image.
label1.ImageList = imageList1;
// Use the second image in imageList1.
label1.ImageIndex = 1;
// Align the image to the top left corner.
label1.ImageAlign = ContentAlignment.TopLeft;
// Specify that the text can display mnemonic characters.
label1.UseMnemonic = true;
// Set the text of the control and specify a mnemonic character.
label1.Text = "First &Name:";
/* Set the size of the control based on the PreferredHeight and PreferredWidth values. */
label1.Size = new Size (label1.PreferredWidth, label1.PreferredHeight);
//...Code to add the control to the form...
}
Public Sub CreateMyLabel()
' Create an instance of a Label.
Dim label1 As New Label()
' Set the border to a three-dimensional border.
label1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
' Set the ImageList to use for displaying an image.
label1.ImageList = imageList1
' Use the second image in imageList1.
label1.ImageIndex = 1
' Align the image to the top left corner.
label1.ImageAlign = ContentAlignment.TopLeft
' Specify that the text can display mnemonic characters.
label1.UseMnemonic = True
' Set the text of the control and specify a mnemonic character.
label1.Text = "First &Name:"
' Set the size of the control based on the PreferredHeight and PreferredWidth values.
label1.Size = New Size(label1.PreferredWidth, label1.PreferredHeight)
'...Code to add the control to the form...
End Sub
Açıklamalar
UseMnemonic özelliği olarak true ayarlanırsa ve özelliğinde LabelText bir anımsatıcı karakter (ve işaretinden önce gelen bir karakter) tanımlanırsa, ALT+ tuşlarına basıldığında, anımsatıcı karakter odağı sekme sırasına göre izleyen denetime Label ayarlar. Formunuzun denetimlerinde düzgün klavye gezintisi sağlamak için bu özelliği kullanabilirsiniz.