VisualStyleElement.Window.Caption 類別

定義

根據視窗標題列的每個狀態提供 VisualStyleElement 物件。 此類別無法獲得繼承。

public: ref class VisualStyleElement::Window::Caption abstract sealed
public static class VisualStyleElement.Window.Caption
type VisualStyleElement.Window.Caption = class
Public Class VisualStyleElement.Window.Caption
繼承
VisualStyleElement.Window.Caption

範例

下列程式碼範例示範如何使用 屬性傳回的 Active 建立 VisualStyleRendererVisualStyleElement 。 若要執行此範例,請將它貼到 Windows Form 中。 處理表單的事件 Paint ,並從事件處理方法呼叫 DrawVisualStyleElementWindowCaption1 方法 Paint ,並傳遞 ePaintEventArgs

public void DrawVisualStyleElementWindowCaption1(PaintEventArgs e)
{
    if (VisualStyleRenderer.IsElementDefined(
        VisualStyleElement.Window.Caption.Active))
    {
        VisualStyleRenderer renderer =
             new VisualStyleRenderer(VisualStyleElement.Window.Caption.Active);
        Rectangle rectangle1 = new Rectangle(10, 50, 50, 50);
        renderer.DrawBackground(e.Graphics, rectangle1);
        e.Graphics.DrawString("VisualStyleElement.Window.Caption.Active",
             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 DrawVisualStyleElementWindowCaption1(ByVal e As PaintEventArgs)
    If (VisualStyleRenderer.IsElementDefined( _
     VisualStyleElement.Window.Caption.Active)) Then
        Dim renderer As New VisualStyleRenderer _
          (VisualStyleElement.Window.Caption.Active)
        Dim rectangle1 As New Rectangle(10, 50, 50, 50)
        renderer.DrawBackground(e.Graphics, rectangle1)
        e.Graphics.DrawString("VisualStyleElement.Window.Caption.Active", _
          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.Window.Caption 都會 VisualStyleElement 針對視窗標題列的不同狀態傳回 。

屬性

Active

取得視覺化樣式項目,表示現用視窗的標題列。

Disabled

取得視覺化樣式項目,表示停用的視窗之標題列。

Inactive

取得視覺化樣式項目,表示非現用視窗的標題列。

適用於

另請參閱