VisualStyleRenderer.GetPartSize Yöntem

Tanım

Geçerli görsel stili bölümünün belirtilen boyut özelliğinin değerini döndürür.

Aşırı Yüklemeler

Name Description
GetPartSize(IDeviceContext, ThemeSizeType)

Geçerli görsel stili bölümünün belirtilen boyut özelliğinin değerini döndürür.

GetPartSize(IDeviceContext, Rectangle, ThemeSizeType)

Belirtilen çizim sınırlarını kullanarak geçerli görsel stili bölümünün belirtilen boyut özelliğinin değerini döndürür.

GetPartSize(IDeviceContext, ThemeSizeType)

Kaynak:
VisualStyleRenderer.cs
Kaynak:
VisualStyleRenderer.cs
Kaynak:
VisualStyleRenderer.cs
Kaynak:
VisualStyleRenderer.cs
Kaynak:
VisualStyleRenderer.cs

Geçerli görsel stili bölümünün belirtilen boyut özelliğinin değerini döndürür.

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

Parametreler

dc
IDeviceContext

Bu IDeviceContext işlem kullanılır.

type
ThemeSizeType

ThemeSizeType Parça için hangi boyut değerinin alındığını belirten değerlerden biri.

Döndürülenler

Size Geçerli görsel stili bölümü için parametresi tarafından type belirtilen boyutu içeren bir.

Özel durumlar

dc, null'e eşittir.

prop değerlerden ThemeSizeType biri değildir.

Örnekler

Aşağıdaki kod örneği, bir pencere başlık çubuğunun GetPartSize(IDeviceContext, ThemeSizeType) , Kapat düğmesinin, kenarlıkların ve görsel stili tarafından belirtilen boyutlandırma tutamacının boyutlarını almak için özel denetimde yönteminin nasıl kullanılacağını gösterir. Bu boyutlar, bu pencere bölümlerini temsil eden nesneleri çizmek Rectangle için kullanılan nesnelerin boyutlarını VisualStyleElement hesaplamak için kullanılır. Bu kod örneği, sınıfa genel bakış için VisualStyleRenderer sağlanan daha büyük bir örneğin parçasıdır.

    // 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

Açıklamalar

Genellikle, bu yöntemin TrueMinimum parametresi için yalnızca ve type değerleri kullanılmalıdır.

Şunlara uygulanır

GetPartSize(IDeviceContext, Rectangle, ThemeSizeType)

Kaynak:
VisualStyleRenderer.cs
Kaynak:
VisualStyleRenderer.cs
Kaynak:
VisualStyleRenderer.cs
Kaynak:
VisualStyleRenderer.cs
Kaynak:
VisualStyleRenderer.cs

Belirtilen çizim sınırlarını kullanarak geçerli görsel stili bölümünün belirtilen boyut özelliğinin değerini döndürür.

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

Parametreler

dc
IDeviceContext

Bu IDeviceContext işlem kullanılır.

bounds
Rectangle

Parçanın Rectangle çizileceği alanı içeren.

type
ThemeSizeType

ThemeSizeType Parça için hangi boyut değerinin alındığını belirten değerlerden biri.

Döndürülenler

Size Geçerli görsel stili bölümü için parametresi tarafından type belirtilen boyutu içeren bir.

Özel durumlar

dc, null'e eşittir.

prop değerlerden ThemeSizeType biri değildir.

Şunlara uygulanır