다음을 통해 공유


ToolStripManager.RenderMode 속성

정의

폼의 기본 테마를 가져오거나 설정합니다.

public:
 static property System::Windows::Forms::ToolStripManagerRenderMode RenderMode { System::Windows::Forms::ToolStripManagerRenderMode get(); void set(System::Windows::Forms::ToolStripManagerRenderMode value); };
public static System.Windows.Forms.ToolStripManagerRenderMode RenderMode { get; set; }
member this.RenderMode : System.Windows.Forms.ToolStripManagerRenderMode with get, set
Public Shared Property RenderMode As ToolStripManagerRenderMode

속성 값

ToolStripManagerRenderMode

ToolStripManagerRenderMode 값 중 하나입니다.

예외

설정된 값이 ToolStripManagerRenderMode 값 중 하나가 아닌 경우

ToolStripManagerRenderModeCustom으로 설정된 경우 Renderer 속성을 대신 사용합니다.

예제

다음 코드 예제를 사용 하는 방법을 보여 줍니다는 RenderMode 속성입니다. 이 예제는에 대해 제공 된 큰 예제의 일부는 Renderer 속성입니다.

// This event handler is invoked when 
// the "Apply Renderers" button is clicked.
// Depending on the value selected in a ComboBox control,
// it applies a custom renderer selectively to
// individual MenuStrip or ToolStrip controls,
// or it applies a custom renderer to the 
// application as a whole.
void applyButton_Click(object sender, EventArgs e)
{
    ToolStrip ms = ToolStripManager.FindToolStrip("MenuStrip");
    ToolStrip ts = ToolStripManager.FindToolStrip("ToolStrip");

    if (targetComboBox.SelectedItem != null)
    {
        switch (targetComboBox.SelectedItem.ToString())
        {
            case "Reset":
            {
                ms.RenderMode = ToolStripRenderMode.ManagerRenderMode;
                ts.RenderMode = ToolStripRenderMode.ManagerRenderMode;

                // Set the default RenderMode to Professional.
                ToolStripManager.RenderMode = ToolStripManagerRenderMode.Professional;

                break;
            }

            case "All":
            {
                ms.RenderMode = ToolStripRenderMode.ManagerRenderMode;
                ts.RenderMode = ToolStripRenderMode.ManagerRenderMode;

                // Assign the custom renderer at the application level.
                ToolStripManager.Renderer = new CustomProfessionalRenderer();

                break;
            }

            case "MenuStrip":
            {
                // Assign the custom renderer to the MenuStrip control only.
                ms.Renderer = new CustomProfessionalRenderer();

                break;
            }

            case "ToolStrip":
            {
                // Assign the custom renderer to the ToolStrip control only.
                ts.Renderer = new CustomProfessionalRenderer();

                break;
            }
        }
    }
}
' This event handler is invoked when 
' the "Apply Renderers" button is clicked.
' Depending on the value selected in a ComboBox 
' control, it applies a custom renderer selectively
' to individual MenuStrip or ToolStrip controls,
' or it applies a custom renderer to the 
' application as a whole.
Sub applyButton_Click(ByVal sender As Object, ByVal e As EventArgs)
    Dim ms As ToolStrip = ToolStripManager.FindToolStrip("MenuStrip")
    Dim ts As ToolStrip = ToolStripManager.FindToolStrip("ToolStrip")

    If targetComboBox.SelectedItem IsNot Nothing Then

        Select Case targetComboBox.SelectedItem.ToString()
            Case "Reset"
                ms.RenderMode = ToolStripRenderMode.ManagerRenderMode
                ts.RenderMode = ToolStripRenderMode.ManagerRenderMode

                ' Set the default RenderMode to Professional.
                ToolStripManager.RenderMode = ToolStripManagerRenderMode.Professional

                Exit Select

            Case "All"
                ms.RenderMode = ToolStripRenderMode.ManagerRenderMode
                ts.RenderMode = ToolStripRenderMode.ManagerRenderMode

                ' Assign the custom renderer at the application level.
                ToolStripManager.Renderer = New CustomProfessionalRenderer()

                Exit Select

            Case "MenuStrip"
                ' Assign the custom renderer to the MenuStrip control only.
                ms.Renderer = New CustomProfessionalRenderer()

                Exit Select

            Case "ToolStrip"
                ' Assign the custom renderer to the ToolStrip control only.
                ts.Renderer = New CustomProfessionalRenderer()

                Exit Select
        End Select

    End If
End Sub

설명

사용 하 여는 RenderMode 가져오거나 애플리케이션으로 그려지는 지 여부를 설정 하는 속성을 ToolStripProfessionalRendererToolStripSystemRenderer, 또는 사용자 지정 ToolStripRenderer.

적용 대상