ToolStripRenderer.InitializeItem メソッド
メモ : このメソッドは、.NET Framework version 2.0 で新しく追加されたものです。
派生クラスでオーバーライドすると、特定の ToolStripItem のカスタムの初期化処理を提供します。
名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文

InitializeItem メソッドを使用すると、ToolStripItem を描画するときに、ToolStripItem.BackColor や ToolStripItem.Font などのプロパティを設定できます。

個々の ToolStripItem コントロールを初期化する方法を次のコード例に示します。このコード例は、ToolStripRenderer クラスのトピックで取り上げているコード例の一部分です。
' This method initializes an individual ToolStripButton ' control. It copies a subimage from the GridStripRenderer's ' main image, according to the position and size of ' the ToolStripButton. Protected Overrides Sub InitializeItem(item As ToolStripItem) MyBase.InitializeItem(item) Dim gs As GridStrip = item.Owner ' The empty cell does not receive a subimage. If ((TypeOf (item) Is ToolStripButton) And _ (item IsNot gs.EmptyCell)) Then ' Copy the subimage from the appropriate ' part of the main image. Dim subImage As Bitmap = bmp.Clone(item.Bounds, PixelFormat.Undefined) ' Assign the subimage to the ToolStripButton ' control's Image property. item.Image = subImage End If End Sub
// This method initializes an individual ToolStripButton // control. It copies a subimage from the GridStripRenderer's // main image, according to the position and size of // the ToolStripButton. protected override void InitializeItem(ToolStripItem item) { base.InitializeItem(item); GridStrip gs = item.Owner as GridStrip; // The empty cell does not receive a subimage. if ((item is ToolStripButton) && (item != gs.EmptyCell)) { // Copy the subimage from the appropriate // part of the main image. Bitmap subImage = bmp.Clone( item.Bounds, PixelFormat.Undefined); // Assign the subimage to the ToolStripButton // control's Image property. item.Image = subImage; } }

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からToolStripRenderer.InitializeItem メソッドを検索する場合は、下記のリンクをクリックしてください。

- ToolStripRenderer.InitializeItem メソッドのページへのリンク