ToolStripItem.TextAlign Propriedade

Definição

Obtém ou define o alinhamento do texto num ToolStripLabel.

public:
 virtual property System::Drawing::ContentAlignment TextAlign { System::Drawing::ContentAlignment get(); void set(System::Drawing::ContentAlignment value); };
public virtual System.Drawing.ContentAlignment TextAlign { get; set; }
member this.TextAlign : System.Drawing.ContentAlignment with get, set
Public Overridable Property TextAlign As ContentAlignment

Valor de Propriedade

Um dos ContentAlignment valores. A predefinição é MiddleRight.

Exceções

O valor atribuído não é um dos valores ContentAlignment .

Exemplos

O seguinte exemplo de código demonstra as Imagepropriedades , ImageAlign, DisplayStyle , e TextAlign para um ToolStripButton. Este exemplo faz parte de um exemplo mais amplo disponível na ToolStripButton visão geral da classe.

this.toolStripButton1.Image = Bitmap.FromFile("c:\\NewItem.bmp");
this.toolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.ImageAndText;
this.toolStripButton1.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.toolStripButton1.Name = "toolStripButton1";
this.toolStripButton1.Text = "&New";
this.toolStripButton1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.toolStripButton1.Click += new System.EventHandler(this.toolStripButton1_Click);
Me.toolStripButton1.Image = Bitmap.FromFile("c:\NewItem.bmp")
Me.toolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.ImageAndText
Me.toolStripButton1.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.toolStripButton1.Name = "toolStripButton1"
Me.toolStripButton1.Text = "&New"
Me.toolStripButton1.TextAlign = System.Drawing.ContentAlignment.MiddleRight

Observações

Use a TextAlign propriedade para obter ou definir o alinhamento de texto num ToolStripItemarquivo . Use a ImageAlign propriedade para obter ou definir o alinhamento da imagem num ToolStripItem.

Aplica-se a

Ver também