ToolStripItem.Image プロパティ
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
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
プロパティ値
表示する Image 。
例
次のコード例は、ToolStripButtonのImage、ImageAlign、DisplayStyle、およびTextAlignプロパティを示しています。 この例は、 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
注釈
Image、ImageAlign、ImageIndex、ImageKey、およびImageScalingプロパティは、画像処理のさまざまな側面に関連します。 これらのプロパティを直接設定するか、実行時専用のImageList プロパティを設定して、ToolStrip コントロールでイメージを使用します。
イメージのスケーリングは、次のように、 ToolStrip と ToolStripItemの両方のプロパティの相互作用によって決まります。
ImageScalingSize は、イメージの ImageScaling 設定とコンテナーの AutoSize 設定の組み合わせによって決定される最終的なイメージのスケールです。
AutoSizeが
true(既定) で、ToolStripItemImageScalingがSizeToFitされている場合、イメージのスケーリングは行われず、ToolStripサイズは最大の項目のサイズまたは規定の最小サイズになります。AutoSizeが
falseされ、ToolStripItemImageScalingがNoneされている場合、イメージもToolStripスケーリングも行われません。