VisualStyleRenderer.GetPartSize 메서드

정의

현재 비주얼 스타일 파트의 지정된 크기 속성 값을 반환합니다.

오버로드

Name Description
GetPartSize(IDeviceContext, ThemeSizeType)

현재 비주얼 스타일 파트의 지정된 크기 속성 값을 반환합니다.

GetPartSize(IDeviceContext, Rectangle, ThemeSizeType)

지정한 드로잉 범위를 사용하여 현재 비주얼 스타일 부분의 지정된 크기 속성 값을 반환합니다.

GetPartSize(IDeviceContext, ThemeSizeType)

Source:
VisualStyleRenderer.cs
Source:
VisualStyleRenderer.cs
Source:
VisualStyleRenderer.cs
Source:
VisualStyleRenderer.cs
Source:
VisualStyleRenderer.cs

현재 비주얼 스타일 파트의 지정된 크기 속성 값을 반환합니다.

public:
 System::Drawing::Size GetPartSize(System::Drawing::IDeviceContext ^ dc, System::Windows::Forms::VisualStyles::ThemeSizeType type);
public System.Drawing.Size GetPartSize(System.Drawing.IDeviceContext dc, System.Windows.Forms.VisualStyles.ThemeSizeType type);
member this.GetPartSize : System.Drawing.IDeviceContext * System.Windows.Forms.VisualStyles.ThemeSizeType -> System.Drawing.Size
Public Function GetPartSize (dc As IDeviceContext, type As ThemeSizeType) As Size

매개 변수

dc
IDeviceContext

IDeviceContext 작업을 사용합니다.

type
ThemeSizeType

파트에 ThemeSizeType 대해 검색할 크기 값을 지정하는 값 중 하나입니다.

반품

현재 비주얼 스타일 부분에 대한 매개 변수로 Size 지정된 크기를 포함하는 A type 입니다.

예외

dcnull입니다.

prop가 값 중 하나가 아닌 경우 ThemeSizeType

예제

다음 코드 예제에서는 사용자 지정 컨트롤에서 메서드를 사용 하 여 GetPartSize(IDeviceContext, ThemeSizeType) 창 제목 표시줄, 닫기 단추, 테두리 및 비주얼 스타일에 의해 지정 된 크기 조정 핸들의 크기를 가져오는 방법을 보여 줍니다. 이러한 크기는 이러한 창 부분을 나타내는 개체를 Rectangle 그리 VisualStyleElement 는 데 사용되는 개체의 크기를 계산하는 데 사용됩니다. 이 코드 예제는 클래스 개요에 제공된 더 큰 예제의 VisualStyleRenderer 일부입니다.

    // Get the sizes and offsets for the window parts as specified
    // by the visual style.
private:
    void GetPartDetails()
    {
        // Do nothing further if visual styles are not enabled.
        if (!Application::RenderWithVisualStyles)
        {
            return;
        }

        Graphics^ g = this->CreateGraphics();

        // Get the size and offset of the close button.
        if (SetRenderer(windowElements["windowClose"]))
        {
            closeButtonSize =
                renderer->GetPartSize(g, ThemeSizeType::True);
            closeButtonOffset =
                renderer->GetPoint(PointProperty::Offset);
        }

        // Get the height of the window caption.
        if (SetRenderer(windowElements["windowCaption"]))
        {
            captionHeight = renderer->GetPartSize(g,
                ThemeSizeType::True).Height;
        }

        // Get the thickness of the left, bottom,
        // and right window frame.
        if (SetRenderer(windowElements["windowLeft"]))
        {
            frameThickness = renderer->GetPartSize(g,
                ThemeSizeType::True).Width;
        }

        // Get the size of the resizing gripper.
        if (SetRenderer(windowElements["statusGripper"]))
        {
            gripperSize = renderer->GetPartSize(g,
                ThemeSizeType::True);
        }

    }
// Get the sizes and offsets for the window parts as specified  
// by the visual style.
private void GetPartDetails()
{
    // Do nothing further if visual styles are not enabled.
    if (!Application.RenderWithVisualStyles)
    {
        return;
    }

    using (Graphics g = this.CreateGraphics())
    {
        // Get the size and offset of the close button.
        if (SetRenderer(windowElements["windowClose"]))
        {
            closeButtonSize =
                renderer.GetPartSize(g, ThemeSizeType.True);
            closeButtonOffset =
                renderer.GetPoint(PointProperty.Offset);
        }

        // Get the height of the window caption.
        if (SetRenderer(windowElements["windowCaption"]))
        {
            captionHeight = renderer.GetPartSize(g,
                ThemeSizeType.True).Height;
        }

        // Get the thickness of the left, bottom, 
        // and right window frame.
        if (SetRenderer(windowElements["windowLeft"]))
        {
            frameThickness = renderer.GetPartSize(g,
                ThemeSizeType.True).Width;
        }

        // Get the size of the resizing gripper.
        if (SetRenderer(windowElements["statusGripper"]))
        {
            gripperSize = renderer.GetPartSize(g,
                ThemeSizeType.True);
        }
    }
}
' Get the sizes and offsets for the window parts as specified 
' by the visual style.
Private Sub GetPartDetails()
    ' Do nothing further if visual styles are not enabled.
    If Not Application.RenderWithVisualStyles Then
        Return
    End If

    Using g As Graphics = Me.CreateGraphics()
        ' Get the size and offset of the close button.
        If SetRenderer(windowElements("windowClose")) Then
            closeButtonSize = _
                renderer.GetPartSize(g, ThemeSizeType.True)
            closeButtonOffset = _
                renderer.GetPoint(PointProperty.Offset)
        End If

        ' Get the height of the window caption.
        If SetRenderer(windowElements("windowCaption")) Then
            captionHeight = renderer.GetPartSize(g, _
                ThemeSizeType.True).Height
        End If

        ' Get the thickness of the left, bottom, and right 
        ' window frame.
        If SetRenderer(windowElements("windowLeft")) Then
            frameThickness = renderer.GetPartSize(g, _
                ThemeSizeType.True).Width
        End If

        ' Get the size of the resizing gripper.
        If SetRenderer(windowElements("statusGripper")) Then
            gripperSize = renderer.GetPartSize(g, _
                ThemeSizeType.True)
        End If
    End Using
End Sub

설명

일반적으로 이 메서드의 매개 변수에는 TrueMinimum 값과 type 값만 사용해야 합니다.

적용 대상

GetPartSize(IDeviceContext, Rectangle, ThemeSizeType)

Source:
VisualStyleRenderer.cs
Source:
VisualStyleRenderer.cs
Source:
VisualStyleRenderer.cs
Source:
VisualStyleRenderer.cs
Source:
VisualStyleRenderer.cs

지정한 드로잉 범위를 사용하여 현재 비주얼 스타일 부분의 지정된 크기 속성 값을 반환합니다.

public:
 System::Drawing::Size GetPartSize(System::Drawing::IDeviceContext ^ dc, System::Drawing::Rectangle bounds, System::Windows::Forms::VisualStyles::ThemeSizeType type);
public System.Drawing.Size GetPartSize(System.Drawing.IDeviceContext dc, System.Drawing.Rectangle bounds, System.Windows.Forms.VisualStyles.ThemeSizeType type);
member this.GetPartSize : System.Drawing.IDeviceContext * System.Drawing.Rectangle * System.Windows.Forms.VisualStyles.ThemeSizeType -> System.Drawing.Size
Public Function GetPartSize (dc As IDeviceContext, bounds As Rectangle, type As ThemeSizeType) As Size

매개 변수

dc
IDeviceContext

IDeviceContext 작업을 사용합니다.

bounds
Rectangle

파트를 그릴 영역을 포함하는 A Rectangle 입니다.

type
ThemeSizeType

파트에 ThemeSizeType 대해 검색할 크기 값을 지정하는 값 중 하나입니다.

반품

현재 비주얼 스타일 부분에 대한 매개 변수로 Size 지정된 크기를 포함하는 A type 입니다.

예외

dcnull입니다.

prop가 값 중 하나가 아닌 경우 ThemeSizeType

적용 대상