ToolStripRenderer.OnRenderToolStripBackground メソッド
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

Dim e As ToolStripRenderEventArgs Me.OnRenderToolStripBackground(e)

イベントが発生すると、デリゲートを使用してイベント ハンドラが呼び出されます。詳細については、「イベントの発生」を参照してください。
OnRenderToolStripBackground メソッドを使用すると、デリゲートを結び付けずに、派生クラスでイベントを処理することもできます。派生クラスでイベントを処理する場合は、この手法をお勧めします。
継承時の注意 派生クラスで OnRenderToolStripBackground をオーバーライドする場合は、登録されているデリゲートがイベントを受け取ることができるように、基本クラスの OnRenderToolStripBackground メソッドを呼び出してください。
OnRenderToolStripBackground メソッドをオーバーライドして、ToolStrip コントロールの背景にグラデーションを描画する方法を次のコード例に示します。このコード例は、ToolStripRenderer クラスのトピックで取り上げているコード例の一部分です。
' This method renders the GridStrip control's background. Protected Overrides Sub OnRenderToolStripBackground(e As ToolStripRenderEventArgs) MyBase.OnRenderToolStripBackground(e) ' This late initialization is a workaround. The gradient ' depends on the bounds of the GridStrip control. The bounds ' are dependent on the layout engine, which hasn't fully ' performed layout by the time the Initialize method runs. If Me.backgroundBrush Is Nothing Then Me.backgroundBrush = New LinearGradientBrush(e.ToolStrip.ClientRectangle, SystemColors.ControlLightLight, SystemColors.ControlDark, 90, True) End If ' Paint the GridStrip control's background. e.Graphics.FillRectangle(Me.backgroundBrush, e.AffectedBounds) End Sub
// This method renders the GridStrip control's background. protected override void OnRenderToolStripBackground( ToolStripRenderEventArgs e) { base.OnRenderToolStripBackground(e); // This late initialization is a workaround. The gradient // depends on the bounds of the GridStrip control. The bounds // are dependent on the layout engine, which hasn't fully // performed layout by the time the Initialize method runs. if (this.backgroundBrush == null) { this.backgroundBrush = new LinearGradientBrush( e.ToolStrip.ClientRectangle, SystemColors.ControlLightLight, SystemColors.ControlDark, 90, true); } // Paint the GridStrip control's background. e.Graphics.FillRectangle( this.backgroundBrush, e.AffectedBounds); }

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.OnRenderToolStripBackground メソッドを検索する場合は、下記のリンクをクリックしてください。

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