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

描画される ToolStrip。

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


- ToolStripRenderEventArgs.ToolStrip プロパティのページへのリンク