ToolStripItem.ImageScaling プロパティ
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

Dim instance As ToolStripItem Dim value As ToolStripItemImageScaling value = instance.ImageScaling instance.ImageScaling = value
[LocalizableAttribute(true)] public: property ToolStripItemImageScaling ImageScaling { ToolStripItemImageScaling get (); void set (ToolStripItemImageScaling value); }
/** @property */ public ToolStripItemImageScaling get_ImageScaling () /** @property */ public void set_ImageScaling (ToolStripItemImageScaling value)
public function get ImageScaling () : ToolStripItemImageScaling public function set ImageScaling (value : ToolStripItemImageScaling)
ToolStripItemImageScaling 値の 1 つ。既定値は SizeToFit です。

ToolStripItem の Image、ImageScaling、および ImageTransparentColor を設定する方法を次のコード例に示します。また、項目にカスタム ツールヒントを設定および表示する方法を示します。
Friend WithEvents imageButton As ToolStripButton Private Sub InitializeImageButtonWithToolTip() ' Construct the button and set the image-related properties. imageButton = New ToolStripButton() imageButton.Image = New Bitmap(GetType(Timer), "Timer.bmp") imageButton.ImageScaling = ToolStripItemImageScaling.SizeToFit ' Set the background color of the image to be transparent. imageButton.ImageTransparentColor = Color.FromArgb(0, 255, 0) ' Show ToolTip text, set custom ToolTip text, and turn ' off the automatic ToolTips. toolStrip1.ShowItemToolTips = True imageButton.ToolTipText = "Click for the current time" imageButton.AutoToolTip = False ' Add the button to the ToolStrip. toolStrip1.Items.Add(imageButton) End Sub
internal ToolStripButton imageButton; private void InitializeImageButtonWithToolTip() { // Construct the button and set the image-related properties. imageButton = new ToolStripButton(); imageButton.Image = new Bitmap(typeof(Timer), "Timer.bmp"); imageButton.ImageScaling = ToolStripItemImageScaling.SizeToFit; // Set the background color of the image to be transparent. imageButton.ImageTransparentColor = Color.FromArgb(0, 255, 0); // Show ToolTip text, set custom ToolTip text, and turn // off the automatic ToolTips. toolStrip1.ShowItemToolTips = true; imageButton.ToolTipText = "Click for the current time"; imageButton.AutoToolTip = false; // Add the button to the ToolStrip. toolStrip1.Items.Add(imageButton); }

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


ToolStripItemImageScaling 列挙体
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

Public Enumeration ToolStripItemImageScaling

メンバ名 | 説明 | |
---|---|---|
None | ToolStripItem 上のイメージのサイズを、ToolStrip に合わせて自動的に調節しないよう指定します。 | |
SizeToFit | ToolStripItem 上のイメージのサイズを、ToolStrip に合わせて自動的に調節するよう指定します。 |


SizeToFit メンバを ToolStripButton に適用するコード例を次に示します。
Friend WithEvents imageButton As ToolStripButton Private Sub InitializeImageButtonWithToolTip() ' Construct the button and set the image-related properties. imageButton = New ToolStripButton() imageButton.Image = New Bitmap(GetType(Timer), "Timer.bmp") imageButton.ImageScaling = ToolStripItemImageScaling.SizeToFit ' Set the background color of the image to be transparent. imageButton.ImageTransparentColor = Color.FromArgb(0, 255, 0) ' Show ToolTip text, set custom ToolTip text, and turn ' off the automatic ToolTips. toolStrip1.ShowItemToolTips = True imageButton.ToolTipText = "Click for the current time" imageButton.AutoToolTip = False ' Add the button to the ToolStrip. toolStrip1.Items.Add(imageButton) End Sub
internal ToolStripButton imageButton; private void InitializeImageButtonWithToolTip() { // Construct the button and set the image-related properties. imageButton = new ToolStripButton(); imageButton.Image = new Bitmap(typeof(Timer), "Timer.bmp"); imageButton.ImageScaling = ToolStripItemImageScaling.SizeToFit; // Set the background color of the image to be transparent. imageButton.ImageTransparentColor = Color.FromArgb(0, 255, 0); // Show ToolTip text, set custom ToolTip text, and turn // off the automatic ToolTips. toolStrip1.ShowItemToolTips = true; imageButton.ToolTipText = "Click for the current time"; imageButton.AutoToolTip = false; // Add the button to the ToolStrip. toolStrip1.Items.Add(imageButton); }

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- ToolStripItemImageScalingのページへのリンク