Sdílet prostřednictvím


ToolStripItem.Image Vlastnost

Definice

Získá nebo nastaví obrázek, který je zobrazen na .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

Zobrazí Image se.

Příklady

Následující příklad kódu ukazuje Image, , ImageAlignDisplayStyle a TextAlign vlastnosti pro a 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, ImageAlign, ImageIndexa ImageKeyImageScaling se vztahují k různým aspektům zpracování obrázků. Obrázky můžete použít v ToolStrip ovládacích prvcích nastavením těchto vlastností přímo nebo nastavením vlastnosti jen ImageList za běhu.

Měřítko obrázku je určeno interakcí vlastností v obou ToolStrip a ToolStripItemnásledujícím způsobem:

Platí pro