VisualStyleElement.ToolBar.SplitButton 類別

定義

針對結合的標準按鈕和下拉式按鈕中標準按鈕部分的每個狀態,提供 VisualStyleElement 物件。Provides VisualStyleElement objects for each state of the regular button portion of a combined regular button and drop-down button. 這個類別無法被繼承。This class cannot be inherited.

public: ref class VisualStyleElement::ToolBar::SplitButton abstract sealed
public static class VisualStyleElement.ToolBar.SplitButton
type VisualStyleElement.ToolBar.SplitButton = class
Public Class VisualStyleElement.ToolBar.SplitButton
繼承
VisualStyleElement.ToolBar.SplitButton

範例

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

public void DrawVisualStyleElementToolBarSplitButton6(PaintEventArgs e)
{
    if (VisualStyleRenderer.IsElementDefined(
        VisualStyleElement.ToolBar.SplitButton.HotChecked))
    {
        VisualStyleRenderer renderer =
             new VisualStyleRenderer(VisualStyleElement.ToolBar.SplitButton.HotChecked);
        Rectangle rectangle1 = new Rectangle(10, 50, 50, 50);
        renderer.DrawBackground(e.Graphics, rectangle1);
        e.Graphics.DrawString("VisualStyleElement.ToolBar.SplitButton.HotChecked",
             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 DrawVisualStyleElementToolBarSplitButton6(ByVal e As PaintEventArgs)
    If (VisualStyleRenderer.IsElementDefined( _
     VisualStyleElement.ToolBar.SplitButton.HotChecked)) Then
        Dim renderer As New VisualStyleRenderer _
          (VisualStyleElement.ToolBar.SplitButton.HotChecked)
        Dim rectangle1 As New Rectangle(10, 50, 50, 50)
        renderer.DrawBackground(e.Graphics, rectangle1)
        e.Graphics.DrawString("VisualStyleElement.ToolBar.SplitButton.HotChecked", _
          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.ToolBar.SplitButton 類別的每個屬性都會針對合併的一般按鈕和下拉按鈕的一般按鈕部分,傳回不同狀態的 VisualStyleElementEach property of the VisualStyleElement.ToolBar.SplitButton class returns a VisualStyleElement for a different state of the regular button portion of a combined regular button and drop-down button.

屬性

Checked

取得視覺化樣式項目,表示處於已核取狀態的分隔按鈕。Gets a visual style element that represents a split button in the checked state.

Disabled

取得視覺化樣式項目,表示處於停用狀態的分隔按鈕。Gets a visual style element that represents a split button in the disabled state.

Hot

取得視覺化樣式項目,表示處於作用中狀態的分隔按鈕。Gets a visual style element that represents a split button in the hot state.

HotChecked

取得視覺化樣式項目,表示處於作用中且已核取狀態的分隔按鈕。Gets a visual style element that represents a split button in the hot and checked states.

Normal

取得視覺化樣式項目,表示處於正常狀態的分隔按鈕。Gets a visual style element that represents a split button in the normal state.

Pressed

取得視覺化樣式項目,表示處於已按下狀態的分隔按鈕。Gets a visual style element that represents a split button in the pressed state.

適用於

另請參閱