TrackBarRenderer.GetTopPointingThumbSize メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > TrackBarRenderer.GetTopPointingThumbSize メソッドの意味・解説 

TrackBarRenderer.GetTopPointingThumbSize メソッド

メモ : このメソッドは、.NET Framework version 2.0 で新しく追加されたものです。

上向きのトラック バーのスライダ (つまみとも呼ばれる) のサイズをピクセル単位で返します。

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Public Shared Function GetTopPointingThumbSize
 ( _
    g As Graphics, _
    state As TrackBarThumbState _
) As Size
Dim g As Graphics
Dim state As TrackBarThumbState
Dim returnValue As Size

returnValue = TrackBarRenderer.GetTopPointingThumbSize(g, state)
public static Size GetTopPointingThumbSize
 (
    Graphics g,
    TrackBarThumbState state
)
public:
static Size GetTopPointingThumbSize (
    Graphics^ g, 
    TrackBarThumbState state
)
public static Size GetTopPointingThumbSize
 (
    Graphics g, 
    TrackBarThumbState state
)
public static function GetTopPointingThumbSize
 (
    g : Graphics, 
    state : TrackBarThumbState
) : Size

パラメータ

g

この操作で使用される Graphics。

state

スライダの表示状態を指定する TrackBarThumbState 値の 1 つ。

戻り値
スライダのサイズをピクセル単位で指定する Size。

例外例外
解説解説
使用例使用例

GetTopPointingThumbSize メソッドを使用して、DrawTopPointingThumb メソッドがスライダを描画するときに使用する四角形のサイズを確認するコード例を、次に示します。このコード例は、TrackBarRenderer クラスのトピックで取り上げているコード例の一部分です。

' Calculate the sizes of the bar, thumb, and ticks rectangle.
Private Sub SetupTrackBar()
    If Not TrackBarRenderer.IsSupported Then
        Return
    End If
    Using g As Graphics = Me.CreateGraphics()
        ' Calculate the size of the track bar.
        trackRectangle.X = ClientRectangle.X + 2
        trackRectangle.Y = ClientRectangle.Y + 28
        trackRectangle.Width = ClientRectangle.Width - 4
        trackRectangle.Height = 4

        ' Calculate the size of the rectangle in which to 
        ' draw the ticks.
        ticksRectangle.X = trackRectangle.X + 4
        ticksRectangle.Y = trackRectangle.Y - 8
        ticksRectangle.Width = trackRectangle.Width - 8
        ticksRectangle.Height = 4

        tickSpace = (CSng(ticksRectangle.Width) - 1) / _
            (CSng(numberTicks) - 1)

        ' Calculate the size of the thumb.
        thumbRectangle.Size = _
            TrackBarRenderer.GetTopPointingThumbSize( _
            g, TrackBarThumbState.Normal)

        thumbRectangle.X = CurrentTickXCoordinate()
        thumbRectangle.Y = trackRectangle.Y - 8
    End Using
End Sub
// Calculate the sizes of the bar, thumb, and ticks rectangle.
private void SetupTrackBar()
{
    if (!TrackBarRenderer.IsSupported)
        return;

    using (Graphics g = this.CreateGraphics())
    {
        // Calculate the size of the track bar.
        trackRectangle.X = ClientRectangle.X + 2;
        trackRectangle.Y = ClientRectangle.Y + 28;
        trackRectangle.Width = ClientRectangle.Width - 4;
        trackRectangle.Height = 4;

        // Calculate the size of the rectangle in which to 
        // draw the ticks.
        ticksRectangle.X = trackRectangle.X + 4;
        ticksRectangle.Y = trackRectangle.Y - 8;
        ticksRectangle.Width = trackRectangle.Width - 8;
        ticksRectangle.Height = 4;

        tickSpace = ((float)ticksRectangle.Width - 1) /
            ((float)numberTicks - 1);

        // Calculate the size of the thumb.
        thumbRectangle.Size =
            TrackBarRenderer.GetTopPointingThumbSize(g,
            TrackBarThumbState.Normal);

        thumbRectangle.X = CurrentTickXCoordinate();
        thumbRectangle.Y = trackRectangle.Y - 8;
    }
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

「TrackBarRenderer.GetTopPointingThumbSize メソッド」の関連用語

TrackBarRenderer.GetTopPointingThumbSize メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



TrackBarRenderer.GetTopPointingThumbSize メソッドのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS