ToolStripItem.Image Vlastnost

Definice

Získá nebo nastaví obrázek, který se zobrazí v objektu 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; }
public virtual System.Drawing.Image? Image { get; set; }
member this.Image : System.Drawing.Image with get, set
Public Overridable Property Image As Image

Hodnota vlastnosti

Hodnota Image , která se má zobrazit.

Příklady

Následující příklad kódu ukazuje Imagevlastnosti , ImageAlign, DisplayStyle a TextAlign pro ToolStripButton. Tento příklad je součástí většího příkladu, který je k dispozici v přehledu ToolStripButton třídy.

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

Poznámky

Vlastnosti Image, , ImageIndexImageAlign, ImageKeya ImageScaling se týkají různých aspektů zpracování imagí. Použijte obrázky v ToolStrip ovládacích prvcích tak, že tyto vlastnosti nastavíte přímo nebo nastavíte vlastnost jen ImageList za běhu.

Měřítko obrázku je určeno interakcí vlastností v systémech a ToolStripToolStripItemnásledujícím způsobem:

Platí pro