Label.BorderStyle 속성

정의

컨트롤의 테두리 스타일을 가져오거나 설정합니다.Gets or sets the border style for the control.

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

속성 값

BorderStyle 값 중 하나입니다.One of the BorderStyle values. 기본값은 BorderStyle.None입니다.The default is BorderStyle.None.

예외

할당된 값이 BorderStyle 값 중 하나가 아닌 경우The value assigned is not one of the BorderStyle values.

예제

다음 코드 예제에서는 ImageListImageIndex 속성을 사용 하 여 3 차원 테두리와 이미지를 표시 하는 Label 컨트롤을 만드는 방법을 보여 줍니다.The following code example demonstrates how to create a Label control that has a three-dimensional border and an image displayed using the ImageList and ImageIndex properties. 컨트롤에 지정 된 니모닉 문자를 사용 하 여는 캡션이 있습니다.The control also has a caption with a mnemonic character specified. 예제 코드는 PreferredHeightPreferredWidth 속성을 사용 하 여 표시 되는 폼에서 Label 컨트롤의 크기를 적절히 조정 합니다.The example code uses the PreferredHeight and PreferredWidth properties to properly size the Label control on the form on which it is displayed. 이 예에서는 ImageList을 만들고 이름을 imageList1로 지정 하 고 두 개의 이미지를 로드 해야 합니다.This example requires that an ImageList has been created and named imageList1 and that it has loaded two images. 또한이 예제에서는 코드에 System.Drawing 네임 스페이스를 추가 하는 폼 안에 코드가 있어야 합니다.The example also requires that the code is within a form that has the System.Drawing namespace added to its code.

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

설명

컨트롤에 테두리를 추가 하려면이 속성을 사용할 수 있습니다.You can use this property to add a border to the control. 이 속성은 구분 데 일반적으로 Label 에서 다른 컨트롤에 레이블는 Label 애플리케이션에서 프로세스의 상태를 표시 하는.This property is typically used to differentiate a Label that labels another control from a Label that displays the status of a process in an application.

적용 대상

추가 정보