TrackBarRenderer.IsSupported TrackBarRenderer.IsSupported TrackBarRenderer.IsSupported TrackBarRenderer.IsSupported Property

定義

visual スタイルを使用してトラック バーを描画するために、TrackBarRenderer クラスを使用できるかどうかを示す値を取得または設定します。Gets a value indicating whether the TrackBarRenderer class can be used to draw a track bar with visual styles.

public:
 static property bool IsSupported { bool get(); };
public static bool IsSupported { get; }
member this.IsSupported : bool
Public Shared ReadOnly Property IsSupported As Boolean

プロパティ値

ユーザーがオペレーティング システムで visual スタイルを有効にしていて、アプリケーション ウィンドウのクライアント領域に visual スタイルが適用される場合は true。それ以外の場合は falsetrue if the user has enabled visual styles in the operating system and visual styles are applied to the client area of application windows; otherwise, false.

次のコード例IsSupportedでは、プロパティを使用して、 TrackBarRendererメソッドを使用するかどうかを判断します。The following code example uses the IsSupported property to determine whether to use the TrackBarRenderer methods. このコード例は、 TrackBarRendererクラスに対して提供される大規模な例の一部です。This code example is part of a larger example provided for the TrackBarRenderer class.

    // 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

注釈

このプロパティがfalseの場合、このクラスのメソッドはをInvalidOperationExceptionスローします。If this property is false, the methods of this class will throw an InvalidOperationException.

適用対象

こちらもご覧ください