Label.BorderStyle 속성

정의

컨트롤의 테두리 스타일을 가져오거나 설정합니다.

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

BorderStyle 값 중 하나입니다. 기본값은 BorderStyle.None입니다.

예외

할당된 값이 BorderStyle 값 중 하나가 아닌 경우

예제

다음 코드 예제에서는 3 차원 테두리와 및 속성을 사용 하 여 표시 되는 이미지를 사용 하 여 컨트롤을 ImageList ImageIndex 만드는 Label 방법을 보여 줍니다. 또한 컨트롤에는 니모닉 문자가 지정된 캡션이 있습니다. 예제 코드는 및 PreferredWidth 속성을 사용하여 PreferredHeight 컨트롤이 표시되는 폼의 Label 컨트롤 크기를 적절하게 조정합니다. 이 예제에서는 imageList1을 ImageList 만들고 명명하고 두 개의 이미지를 로드해야 합니다. 또한 이 예제에서는 코드에 네임스페이스가 추가된 System.Drawing 양식 내에 코드가 있어야 합니다.

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

설명

컨트롤에 테두리를 추가 하려면이 속성을 사용할 수 있습니다. 이 속성은 구분 데 일반적으로 Label 에서 다른 컨트롤에 레이블는 Label 애플리케이션에서 프로세스의 상태를 표시 하는.

적용 대상

추가 정보