共用方式為


VisualStyleElement.Window.Dialog 類別

定義

提供 VisualStyleElement 對話框背景。 無法繼承這個類別。

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

範例

以下程式碼範例示範如何用屬性VisualStyleElement回傳Normal的 來建立 aVisualStyleRenderer。 要執行這個範例,請將它貼到 Windows 表單中。 處理表單的Paint事件,並從DrawVisualStyleElementWindowDialog1事件處理方法呼叫該Paint方法,傳遞ePaintEventArgs

public void DrawVisualStyleElementWindowDialog1(PaintEventArgs e)
{
    if (VisualStyleRenderer.IsElementDefined(
        VisualStyleElement.Window.Dialog.Normal))
    {
        VisualStyleRenderer renderer =
             new VisualStyleRenderer(VisualStyleElement.Window.Dialog.Normal);
        Rectangle rectangle1 = new Rectangle(10, 50, 50, 50);
        renderer.DrawBackground(e.Graphics, rectangle1);
        e.Graphics.DrawString("VisualStyleElement.Window.Dialog.Normal",
             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 DrawVisualStyleElementWindowDialog1(ByVal e As PaintEventArgs)
    If (VisualStyleRenderer.IsElementDefined( _
     VisualStyleElement.Window.Dialog.Normal)) Then
        Dim renderer As New VisualStyleRenderer _
          (VisualStyleElement.Window.Dialog.Normal)
        Dim rectangle1 As New Rectangle(10, 50, 50, 50)
        renderer.DrawBackground(e.Graphics, rectangle1)
        e.Graphics.DrawString("VisualStyleElement.Window.Dialog.Normal", _
          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

備註

類別的NormalVisualStyleElement.Window.Dialog屬性回傳 aVisualStyleElement,代表對話框的背景。

屬性

名稱 Description
Normal

會獲得一個視覺風格元素,代表對話框的背景。

適用於

另請參閱