TrackBarRenderer.DrawTopPointingThumb 메서드

정의

비주얼 스타일을 사용하여 위쪽 방향 트랙 표시줄 슬라이더(엄지 단추)를 그립니다.

public:
 static void DrawTopPointingThumb(System::Drawing::Graphics ^ g, System::Drawing::Rectangle bounds, System::Windows::Forms::VisualStyles::TrackBarThumbState state);
public static void DrawTopPointingThumb (System.Drawing.Graphics g, System.Drawing.Rectangle bounds, System.Windows.Forms.VisualStyles.TrackBarThumbState state);
static member DrawTopPointingThumb : System.Drawing.Graphics * System.Drawing.Rectangle * System.Windows.Forms.VisualStyles.TrackBarThumbState -> unit
Public Shared Sub DrawTopPointingThumb (g As Graphics, bounds As Rectangle, state As TrackBarThumbState)

매개 변수

g
Graphics

트랙 표시줄 슬라이더를 그릴 때 사용되는 Graphics입니다.

bounds
Rectangle

트랙 표시줄 슬라이더의 범위를 지정하는 Rectangle입니다.

state
TrackBarThumbState

트랙 표시줄 슬라이더의 표시 상태를 지정하는 TrackBarThumbState 값 중 하나입니다.

예외

운영 체제에서 비주얼 스타일을 지원하지 않는 경우

또는

운영 체제에서 사용자가 비주얼 스타일을 사용하지 않도록 설정한 경우

또는

비주얼 스타일이 애플리케이션 창의 클라이언트 영역에 적용되지 않은 경우

예제

다음 코드 예제에서는 합니다 DrawTopPointingThumb 메서드는 사용자 지정 컨트롤의 OnPaint 트랙 표시줄 슬라이더를 위쪽 방향 그리는 메서드. 이 코드 예제는에 대해 제공 된 큰 예제의 일부는 TrackBarRenderer 클래스입니다.

    // Draw the track bar.
protected:
    virtual void OnPaint(PaintEventArgs^ e) override
    {
        if (!TrackBarRenderer::IsSupported)
        {
            this->Parent->Text = "CustomTrackBar Disabled";
            return;
        }

        this->Parent->Text = "CustomTrackBar Enabled";
        TrackBarRenderer::DrawHorizontalTrack(e->Graphics,
            trackRectangle);
        TrackBarRenderer::DrawTopPointingThumb(e->Graphics,
            thumbRectangle, thumbState);
        TrackBarRenderer::DrawHorizontalTicks(e->Graphics,
            ticksRectangle, numberTicks, EdgeStyle::Raised);
    }

    // Determine whether the user has clicked the track bar thumb.
protected:
    virtual void OnMouseDown(MouseEventArgs^ e) override
    {
        if (!TrackBarRenderer::IsSupported)
        {
            return;
        }
        if (this->thumbRectangle.Contains(e->Location))
        {
            thumbClicked = true;
            thumbState = TrackBarThumbState::Pressed;
        }

        this->Invalidate();
    }
// Draw the track bar.
protected override void OnPaint(PaintEventArgs e)
{
    if (!TrackBarRenderer.IsSupported)
    {
        this.Parent.Text = "CustomTrackBar Disabled";
        return;
    }

    this.Parent.Text = "CustomTrackBar Enabled";
    TrackBarRenderer.DrawHorizontalTrack(e.Graphics,
        trackRectangle);
    TrackBarRenderer.DrawTopPointingThumb(e.Graphics,
        thumbRectangle, thumbState);
    TrackBarRenderer.DrawHorizontalTicks(e.Graphics,
        ticksRectangle, numberTicks, EdgeStyle.Raised);
}

// Determine whether the user has clicked the track bar thumb.
protected override void OnMouseDown(MouseEventArgs e)
{
    if (!TrackBarRenderer.IsSupported)
        return;

    if (this.thumbRectangle.Contains(e.Location))
    {
        thumbClicked = true;
        thumbState = TrackBarThumbState.Pressed;
    }

    this.Invalidate();
}
' Draw the track bar.
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
    If Not TrackBarRenderer.IsSupported Then
        Me.Parent.Text = "CustomTrackBar Disabled"
        Return
    End If

    Me.Parent.Text = "CustomTrackBar Enabled"
    TrackBarRenderer.DrawHorizontalTrack(e.Graphics, _
        trackRectangle)
    TrackBarRenderer.DrawTopPointingThumb(e.Graphics, _
        thumbRectangle, thumbState)
    TrackBarRenderer.DrawHorizontalTicks(e.Graphics, _
        ticksRectangle, numberTicks, EdgeStyle.Raised)
End Sub

' Determine whether the user has clicked the track bar thumb.
Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
    If Not TrackBarRenderer.IsSupported Then
        Return
    End If
    If Me.thumbRectangle.Contains(e.Location) Then
        thumbClicked = True
        thumbState = TrackBarThumbState.Pressed
    End If

    Me.Invalidate()
End Sub

설명

이 메서드를 호출 하기 전에 확인 해야 하는 값을 IsSupported 속성은 true합니다.

적용 대상