Label.BorderStyle Özellik

Tanım

Denetimin kenarlık stilini alır veya ayarlar.

public:
 virtual property System::Windows::Forms::BorderStyle BorderStyle { System::Windows::Forms::BorderStyle get(); void set(System::Windows::Forms::BorderStyle value); };
public virtual System.Windows.Forms.BorderStyle BorderStyle { get; set; }
member this.BorderStyle : System.Windows.Forms.BorderStyle with get, set
Public Overridable Property BorderStyle As BorderStyle

Özellik Değeri

BorderStyle

Değerlerden BorderStyle biri. Varsayılan değer: BorderStyle.None.

Özel durumlar

Atanan değer değerlerden BorderStyle biri değildir.

Ö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 resim yazısı 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

Denetime kenarlık eklemek için bu özelliği kullanabilirsiniz. Bu özellik genellikle bir uygulamadaki bir Label işlemin durumunu görüntüleyen başka bir Label denetimi etiketleyen bir denetimi ayırt etmek için kullanılır.

Şunlara uygulanır

Ayrıca bkz.