다음을 통해 공유


ToolBar.TextAlign 속성

ToolBar Button 컨트롤에 표시되는 각 이미지에 대한 텍스트 맞춤 방식을 가져오거나 설정합니다.

네임스페이스: System.Windows.Forms
어셈블리: System.Windows.Forms(system.windows.forms.dll)

구문

‘선언
<LocalizableAttribute(True)> _
Public Property TextAlign As ToolBarTextAlign
‘사용 방법
Dim instance As ToolBar
Dim value As ToolBarTextAlign

value = instance.TextAlign

instance.TextAlign = value
[LocalizableAttribute(true)] 
public ToolBarTextAlign TextAlign { get; set; }
[LocalizableAttribute(true)] 
public:
property ToolBarTextAlign TextAlign {
    ToolBarTextAlign get ();
    void set (ToolBarTextAlign value);
}
/** @property */
public ToolBarTextAlign get_TextAlign ()

/** @property */
public void set_TextAlign (ToolBarTextAlign value)
public function get TextAlign () : ToolBarTextAlign

public function set TextAlign (value : ToolBarTextAlign)

속성 값

ToolBarTextAlign 값 중 하나입니다. 기본값은 ToolBarTextAlign.Underneath입니다.

예외

예외 형식 조건

InvalidEnumArgumentException

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

설명

TextToolBarButton 컨트롤에 표시되는 이미지의 아래쪽 또는 오른쪽에 맞춰질 수 있습니다.

예제

다음 코드 예제에서는 ToolBar 컨트롤을 만들고 공용 속성 중 일부를 설정한 다음 해당 컨트롤을 Form에 추가합니다. 또한 대리자도 ButtonClickButtonDropDown 이벤트에 추가됩니다. 이 예제를 실행하려면 toolBar1이라는 ToolBarimageList1이라는 ImageList가 선언되어 있어야 합니다.

Private Sub AddToolBar()
   ' Add a toolbar and set some of its properties.
   toolBar1 = New ToolBar()
   toolBar1.Appearance = System.Windows.Forms.ToolBarAppearance.Flat
   toolBar1.BorderStyle = System.Windows.Forms.BorderStyle.None
   toolBar1.Buttons.Add(Me.toolBarButton1)
   toolBar1.ButtonSize = New System.Drawing.Size(24, 24)
   toolBar1.Divider = True
   toolBar1.DropDownArrows = True
   toolBar1.ImageList = Me.imageList1
   toolBar1.ShowToolTips = True
   toolBar1.Size = New System.Drawing.Size(292, 25)
   toolBar1.TabIndex = 0
   toolBar1.TextAlign = System.Windows.Forms.ToolBarTextAlign.Right
   toolBar1.Wrappable = False

   ' Add handlers for the ButtonClick and ButtonDropDown events.
   AddHandler toolBar1.ButtonDropDown, AddressOf toolBar1_ButtonDropDown
   AddHandler toolBar1.ButtonClick, AddressOf toolBar1_ButtonClicked

   ' Add the toolbar to the form.
   Me.Controls.Add(toolBar1)
End Sub
private void AddToolBar()
{
   // Add a toolbar and set some of its properties.
   toolBar1 = new ToolBar();
   toolBar1.Appearance = System.Windows.Forms.ToolBarAppearance.Flat;
   toolBar1.BorderStyle = System.Windows.Forms.BorderStyle.None;
   toolBar1.Buttons.Add(this.toolBarButton1);
   toolBar1.ButtonSize = new System.Drawing.Size(24, 24);
   toolBar1.Divider = true;
   toolBar1.DropDownArrows = true;
   toolBar1.ImageList = this.imageList1;
   toolBar1.ShowToolTips = true;
   toolBar1.Size = new System.Drawing.Size(292, 25);
   toolBar1.TabIndex = 0;
   toolBar1.TextAlign = System.Windows.Forms.ToolBarTextAlign.Right;
   toolBar1.Wrappable = false;
   
   // Add handlers for the ButtonClick and ButtonDropDown events.
   toolBar1.ButtonDropDown += 
     new ToolBarButtonClickEventHandler(toolBar1_ButtonDropDown);
   toolBar1.ButtonClick += 
     new ToolBarButtonClickEventHandler(toolBar1_ButtonClicked);

   // Add the toolbar to the form.
   this.Controls.Add(toolBar1);
}
void AddToolBar()
{
   
   // Add a toolbar and set some of its properties.
   toolBar1 = gcnew ToolBar;
   toolBar1->Appearance = System::Windows::Forms::ToolBarAppearance::Flat;
   toolBar1->BorderStyle = System::Windows::Forms::BorderStyle::None;
   toolBar1->Buttons->Add( this->toolBarButton1 );
   toolBar1->ButtonSize = System::Drawing::Size( 24, 24 );
   toolBar1->Divider = true;
   toolBar1->DropDownArrows = true;
   toolBar1->ImageList = this->imageList1;
   toolBar1->ShowToolTips = true;
   toolBar1->Size = System::Drawing::Size( 292, 25 );
   toolBar1->TabIndex = 0;
   toolBar1->TextAlign = System::Windows::Forms::ToolBarTextAlign::Right;
   toolBar1->Wrappable = false;
   
   // Add handlers for the ButtonClick and ButtonDropDown events.
   toolBar1->ButtonDropDown += gcnew ToolBarButtonClickEventHandler( this, &MyToolBar::toolBar1_ButtonDropDown );
   toolBar1->ButtonClick += gcnew ToolBarButtonClickEventHandler( this, &MyToolBar::toolBar1_ButtonClicked );
   
   // Add the toolbar to the form.
   this->Controls->Add( toolBar1 );
}
private void AddToolBar()
{
    // Add a toolbar and set some of its properties.
    toolBar1 = new ToolBar();
    toolBar1.set_Appearance(System.Windows.Forms.ToolBarAppearance.Flat);
    toolBar1.set_BorderStyle(System.Windows.Forms.BorderStyle.None);
    toolBar1.get_Buttons().Add(this.toolBarButton1);
    toolBar1.set_ButtonSize(new System.Drawing.Size(24, 24));
    toolBar1.set_Divider(true);
    toolBar1.set_DropDownArrows(true);
    toolBar1.set_ImageList(this.imageList1);
    toolBar1.set_ShowToolTips(true);
    toolBar1.set_Size(new System.Drawing.Size(292, 25));
    toolBar1.set_TabIndex(0);
    toolBar1.set_TextAlign(System.Windows.Forms.ToolBarTextAlign.Right);
    toolBar1.set_Wrappable(false);
    // Add handlers for the ButtonClick and ButtonDropDown events.
    toolBar1.add_ButtonDropDown(new ToolBarButtonClickEventHandler
        (toolBar1_ButtonDropDown));
    toolBar1.add_ButtonClick(new ToolBarButtonClickEventHandler
        (toolBar1_ButtonClicked));
    // Add the toolbar to the form.
    this.get_Controls().Add(toolBar1);
} //AddToolBar

플랫폼

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

참고 항목

참조

ToolBar 클래스
ToolBar 멤버
System.Windows.Forms 네임스페이스
ToolBarTextAlign