VisualStyleElement.ScrollBar.SizeBox 類別

定義

針對捲軸縮放控點 (Sizing Handle) 的每個狀態提供 VisualStyleElement 物件。Provides VisualStyleElement objects for each state of the sizing handle of a scroll bar. 此類別無法獲得繼承。This class cannot be inherited.

public: ref class VisualStyleElement::ScrollBar::SizeBox abstract sealed
public static class VisualStyleElement.ScrollBar.SizeBox
type VisualStyleElement.ScrollBar.SizeBox = class
Public Class VisualStyleElement.ScrollBar.SizeBox
繼承
VisualStyleElement.ScrollBar.SizeBox

範例

下列程式碼範例示範如何 VisualStyleRenderer 使用屬性所傳回的來建立 VisualStyleElement RightAlignThe following code example demonstrates how to create a VisualStyleRenderer with the VisualStyleElement returned by the RightAlign property. 若要執行此範例,請將它貼到 Windows Form 中。To run this example, paste it into a Windows Form. 處理表單的 Paint 事件,並 DrawVisualStyleElementScrollBarSizeBox1Paint 事件處理方法呼叫方法,傳遞 ePaintEventArgsHandle the form's Paint event and call the DrawVisualStyleElementScrollBarSizeBox1 method from the Paint event-handling method, passing e as PaintEventArgs.

public void DrawVisualStyleElementScrollBarSizeBox1(PaintEventArgs e)
{
    if (VisualStyleRenderer.IsElementDefined(
        VisualStyleElement.ScrollBar.SizeBox.RightAlign))
    {
        VisualStyleRenderer renderer =
             new VisualStyleRenderer(VisualStyleElement.ScrollBar.SizeBox.RightAlign);
        Rectangle rectangle1 = new Rectangle(10, 50, 50, 50);
        renderer.DrawBackground(e.Graphics, rectangle1);
        e.Graphics.DrawString("VisualStyleElement.ScrollBar.SizeBox.RightAlign",
             this.Font, Brushes.Black, new Point(10, 10));
    }
    else
        e.Graphics.DrawString("This element is not defined in the current visual style.",
             this.Font, Brushes.Black, new Point(10, 10));
}
Public Sub DrawVisualStyleElementScrollBarSizeBox1(ByVal e As PaintEventArgs)
    If (VisualStyleRenderer.IsElementDefined( _
     VisualStyleElement.ScrollBar.SizeBox.RightAlign)) Then
        Dim renderer As New VisualStyleRenderer _
          (VisualStyleElement.ScrollBar.SizeBox.RightAlign)
        Dim rectangle1 As New Rectangle(10, 50, 50, 50)
        renderer.DrawBackground(e.Graphics, rectangle1)
        e.Graphics.DrawString("VisualStyleElement.ScrollBar.SizeBox.RightAlign", _
          Me.Font, Brushes.Black, New Point(10, 10))
    Else
        e.Graphics.DrawString("This element is not defined in the current visual style.", _
          Me.Font, Brushes.Black, New Point(10, 10))
    End If
End Sub

備註

類別的每個屬性都會傳回 VisualStyleElement.ScrollBar.SizeBox VisualStyleElement 捲軸之調整大小控點的。Each property of the VisualStyleElement.ScrollBar.SizeBox class returns a VisualStyleElement for the sizing handle of a scroll bar.

屬性

LeftAlign

取得視覺化樣式項目,表示靠左對齊的縮放控點。Gets a visual style element that represents a sizing handle that is aligned to the left.

RightAlign

取得視覺化樣式項目,表示靠右對齊的縮放控點。Gets a visual style element that represents a sizing handle that is aligned to the right.

適用於

另請參閱