Label.UseMnemonic Özellik

Tanım

Denetimin özelliğindeki bir ve karakterini (&) Text 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 karakterini görüntülemiyorsa ve görüntülenen metninde ve işaretinden sonraki karakterin altını çizer ve altı çizili karakteri bir erişim tuşu olarak değerlendirirse; aksi takdirde, false ve karakteri denetimin metninde görüntüleniyorsa. Varsayılan değer: true.

Örnekler

Aşağıdaki kod örneği, üç boyutlu kenarlık Label ve ve ImageIndex özellikleri kullanılarak görüntülenen bir görüntüye sahip bir denetimin ImageList nasıl oluşturulacağını gösterir. Denetimin ayrıca, belirtilen bir anımsatıcı karakteri olan bir başlık vardır. Örnek kod, denetimi görüntülendiği formda düzgün boyutlandırmak Label için ve PreferredWidth özelliklerini kullanırPreferredHeight. Bu örnek için bir ImageList oluşturulup imageList1 olarak adlandırılmış olması ve iki görüntü yüklemesi gerekir. Örnek ayrıca kodun ad alanının koduna System.Drawing eklendiği bir formda 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şuna basıldığında anımsatıcı karakter odağı sekme sırasına göre gelen denetime Label ayarlar. Formunuzun denetimlerinde düzgün klavye gezintisi sağlamak için bu özelliği kullanabilirsiniz.

Şunlara uygulanır

Ayrıca bkz.