VisualStyleRenderer.GetPartSize 메서드

정의

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

오버로드

GetPartSize(IDeviceContext, ThemeSizeType)

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

GetPartSize(IDeviceContext, Rectangle, ThemeSizeType)

지정된 그리기 범위를 사용하여 현재 비주얼 스타일 파트에 대해 지정된 크기 속성 값을 반환합니다.

GetPartSize(IDeviceContext, ThemeSizeType)

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

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

현재 비주얼 스타일 파트에 대해 type 매개 변수에서 지정한 크기를 포함하는 Size입니다.

예외

dc이(가) null인 경우

propThemeSizeType 값 중 하나가 아닌 경우

예제

다음 코드 예제에서는 사용자 지정 컨트롤에서 메서드를 사용 하 여 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

설명

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

적용 대상

GetPartSize(IDeviceContext, Rectangle, ThemeSizeType)

지정된 그리기 범위를 사용하여 현재 비주얼 스타일 파트에 대해 지정된 크기 속성 값을 반환합니다.

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

파트를 그릴 영역이 포함된 Rectangle입니다.

type
ThemeSizeType

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

반환

Size

현재 비주얼 스타일 파트에 대해 type 매개 변수에서 지정한 크기를 포함하는 Size입니다.

예외

dc이(가) null인 경우

propThemeSizeType 값 중 하나가 아닌 경우

적용 대상