次の方法で共有


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 プロパティによって返されるVisualStyleElementを使用してVisualStyleRendererを作成する方法を示します。 この例を実行するには、Windows フォームに貼り付けます。 フォームの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

アクティブなウィンドウのタイトル バーを表す visual スタイル要素を取得します。

Disabled

無効なウィンドウのタイトル バーを表す visual スタイル要素を取得します。

Inactive

非アクティブなウィンドウのタイトル バーを表す visual スタイル要素を取得します。

適用対象

こちらもご覧ください