ToolStripItem.ImageAlign 屬性

定義

取得或設定 ToolStripItem 上影像的對齊方式。

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

屬性值

ContentAlignment

其中一個 ContentAlignment 值。 預設為 MiddleLeft

例外狀況

所指派的值不是其中一個 ContentAlignment 值。

範例

下列程式碼範例示範 的 ImageImageAlign DisplayStyle 、 和 TextAlign 屬性 ToolStripButton 。 此範例是類別概觀中較大範例的 ToolStripButton 一部分。

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

備註

ImageAlign使用 屬性取得或設定 上的 ToolStripItem 影像對齊方式。 TextAlign使用 屬性取得或設定 上的 ToolStripItem 文字對齊方式。

ImageImageAlignImageIndexImageKeyImageScaling 屬性與影像處理的各種層面有關。 直接設定這些屬性,或設定僅限 ImageList 執行時間屬性,以在控制項中使用 ToolStrip 影像。

影像縮放是由 和 ToolStripItem 中的 ToolStrip 屬性互動所決定,如下所示:

適用於

另請參閱