ToolStripItem.Image 屬性

定義

取得或設定顯示在 ToolStripItem 上的影像。

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

屬性值

Image

要顯示的 Image

範例

下列程式碼範例示範 的 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

備註

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

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

適用於