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

Public Shared Sub DrawRightHorizontalTrack ( _ g As Graphics, _ bounds As Rectangle, _ state As ScrollBarState _ )
Dim g As Graphics Dim bounds As Rectangle Dim state As ScrollBarState ScrollBarRenderer.DrawRightHorizontalTrack(g, bounds, state)
public: static void DrawRightHorizontalTrack ( Graphics^ g, Rectangle bounds, ScrollBarState state )
public static function DrawRightHorizontalTrack ( g : Graphics, bounds : Rectangle, state : ScrollBarState )



カスタム コントロールの OnPaint メソッドで DrawRightHorizontalTrack メソッドを使用して、スクロール バーのトラックを描画するコード例を次に示します。このコード例は、ScrollBarRenderer クラスのトピックで取り上げているコード例の一部分です。
' Draw the scroll bar in its normal state. Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs) MyBase.OnPaint(e) ' Visual styles are not enabled. If Not ScrollBarRenderer.IsSupported Then Me.Parent.Text = "CustomScrollBar Disabled" Return End If Me.Parent.Text = "CustomScrollBar Enabled" ' Draw the scroll bar track. ScrollBarRenderer.DrawRightHorizontalTrack(e.Graphics, _ Me.ClientRectangle, ScrollBarState.Normal) ' Draw the thumb and thumb grip in the current state. ScrollBarRenderer.DrawHorizontalThumb(e.Graphics, _ thumbRectangle, thumbState) ScrollBarRenderer.DrawHorizontalThumbGrip(e.Graphics, _ thumbRectangle, thumbState) ' Draw the scroll arrows in the current state. ScrollBarRenderer.DrawArrowButton(e.Graphics, _ leftArrowRectangle, leftButtonState) ScrollBarRenderer.DrawArrowButton(e.Graphics, _ rightArrowRectangle, rightButtonState) ' Draw a highlighted rectangle in the left side of the scroll ' bar track if the user has clicked between the left arrow ' and thumb. If leftBarClicked Then clickedBarRectangle.X = thumbLeftLimit clickedBarRectangle.Width = thumbRectangle.X - thumbLeftLimit ScrollBarRenderer.DrawLeftHorizontalTrack(e.Graphics, _ clickedBarRectangle, ScrollBarState.Pressed) ' Draw a highlighted rectangle in the right side of the scroll ' bar track if the user has clicked between the right arrow ' and thumb. ElseIf rightBarClicked Then clickedBarRectangle.X = thumbRectangle.X + _ thumbRectangle.Width clickedBarRectangle.Width = thumbRightLimitRight - _ clickedBarRectangle.X ScrollBarRenderer.DrawRightHorizontalTrack(e.Graphics, _ clickedBarRectangle, ScrollBarState.Pressed) End If End Sub
// Draw the scroll bar in its normal state. protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); // Visual styles are not enabled. if (!ScrollBarRenderer.IsSupported) { this.Parent.Text = "CustomScrollBar Disabled"; return; } this.Parent.Text = "CustomScrollBar Enabled"; // Draw the scroll bar track. ScrollBarRenderer.DrawRightHorizontalTrack(e.Graphics, ClientRectangle, ScrollBarState.Normal); // Draw the thumb and thumb grip in the current state. ScrollBarRenderer.DrawHorizontalThumb(e.Graphics, thumbRectangle, thumbState); ScrollBarRenderer.DrawHorizontalThumbGrip(e.Graphics, thumbRectangle, thumbState); // Draw the scroll arrows in the current state. ScrollBarRenderer.DrawArrowButton(e.Graphics, leftArrowRectangle, leftButtonState); ScrollBarRenderer.DrawArrowButton(e.Graphics, rightArrowRectangle, rightButtonState); // Draw a highlighted rectangle in the left side of the scroll // bar track if the user has clicked between the left arrow // and thumb. if (leftBarClicked) { clickedBarRectangle.X = thumbLeftLimit; clickedBarRectangle.Width = thumbRectangle.X - thumbLeftLimit; ScrollBarRenderer.DrawLeftHorizontalTrack(e.Graphics, clickedBarRectangle, ScrollBarState.Pressed); } // Draw a highlighted rectangle in the right side of the scroll // bar track if the user has clicked between the right arrow // and thumb. else if (rightBarClicked) { clickedBarRectangle.X = thumbRectangle.X + thumbRectangle.Width; clickedBarRectangle.Width = thumbRightLimitRight - clickedBarRectangle.X; ScrollBarRenderer.DrawRightHorizontalTrack(e.Graphics, clickedBarRectangle, ScrollBarState.Pressed); } }
// Draw the scroll bar in its normal state. protected: virtual void OnPaint(PaintEventArgs^ e) override { __super::OnPaint(e); // Visual styles are not enabled. if (!ScrollBarRenderer::IsSupported) { this->Parent->Text = "CustomScrollBar Disabled"; return; } this->Parent->Text = "CustomScrollBar Enabled"; // Draw the scroll bar track. ScrollBarRenderer::DrawRightHorizontalTrack(e->Graphics, ClientRectangle, ScrollBarState::Normal); // Draw the thumb and thumb grip in the current state. ScrollBarRenderer::DrawHorizontalThumb(e->Graphics, thumbRectangle, thumbState); ScrollBarRenderer::DrawHorizontalThumbGrip(e->Graphics, thumbRectangle, thumbState); // Draw the scroll arrows in the current state. ScrollBarRenderer::DrawArrowButton(e->Graphics, leftArrowRectangle, leftButtonState); ScrollBarRenderer::DrawArrowButton(e->Graphics, rightArrowRectangle, rightButtonState); // Draw a highlighted rectangle in the left side of the scroll // bar track if the user has clicked between the left arrow // and thumb. if (leftBarClicked) { clickedBarRectangle.X = thumbLeftLimit; clickedBarRectangle.Width = thumbRectangle.X - thumbLeftLimit; ScrollBarRenderer::DrawLeftHorizontalTrack(e->Graphics, clickedBarRectangle, ScrollBarState::Pressed); } // Draw a highlighted rectangle in the right side of the scroll // bar track if the user has clicked between the right arrow // and thumb. else if (rightBarClicked) { clickedBarRectangle.X = thumbRectangle.X + thumbRectangle.Width; clickedBarRectangle.Width = thumbRightLimitRight - clickedBarRectangle.X; ScrollBarRenderer::DrawRightHorizontalTrack(e->Graphics, clickedBarRectangle, ScrollBarState::Pressed); } }

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に収録されているすべての辞書からScrollBarRenderer.DrawRightHorizontalTrack メソッドを検索する場合は、下記のリンクをクリックしてください。

- ScrollBarRenderer.DrawRightHorizontalTrack メソッドのページへのリンク