ToolStripRenderer.InitializeItem メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > ToolStripRenderer.InitializeItem メソッドの意味・解説 

ToolStripRenderer.InitializeItem メソッド

メモ : このメソッドは、.NET Framework version 2.0新しく追加されたものです。

派生クラスオーバーライドすると、特定の ToolStripItemカスタム初期化処理提供します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Protected Friend Overridable
 Sub InitializeItem ( _
    item As ToolStripItem _
)
Dim item As ToolStripItem

Me.InitializeItem(item)
protected internal virtual void InitializeItem
 (
    ToolStripItem item
)
protected public:
virtual void InitializeItem (
    ToolStripItem^ item
)
protected void InitializeItem (
    ToolStripItem item
)
protected internal function
 InitializeItem (
    item : ToolStripItem
)

パラメータ

item

初期化する ToolStripItem。

解説解説

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;
    }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からToolStripRenderer.InitializeItem メソッドを検索した結果を表示しています。
Weblioに収録されているすべての辞書からToolStripRenderer.InitializeItem メソッドを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からToolStripRenderer.InitializeItem メソッド を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

ToolStripRenderer.InitializeItem メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



ToolStripRenderer.InitializeItem メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS