ID2D1RenderTarget::FillRoundedRectangle(constD2D1_ROUNDED_RECT&,ID2D1Brush*) 메서드(d2d1.h)

지정된 둥근 사각형의 내부를 그립니다.

구문

void FillRoundedRectangle(
       const D2D1_ROUNDED_RECT & roundedRect,
  [in] ID2D1Brush                *brush
);

매개 변수

roundedRect

형식: [in] const D2D1_ROUNDED_RECT &

그릴 둥근 사각형의 크기(디바이스 독립적 픽셀)입니다.

[in] brush

형식: [in] ID2D1Brush*

둥근 사각형의 내부를 그리는 데 사용되는 브러시입니다.

반환 값

없음

설명

이 메서드는 실패할 경우 오류 코드를 반환하지 않습니다. 그리기 작업(예: FillRoundedRectangle)이 실패했는지 여부를 확인하려면 ID2D1RenderTarget::EndDraw 또는 ID2D1RenderTarget::Flush 메서드에서 반환된 결과를 검사.

예제

다음 예제에서는 DrawRoundedRectangleFillRoundedRectangle 메서드를 사용하여 둥근 사각형을 윤곽선으로 표시하고 채웁니다. 이 예제에서는 다음 그림에 표시된 출력을 생성합니다.

스트로크 스타일과 채우기가 다른 4개의 둥근 사각형 그림
//  Called whenever the application needs to display the client
//  window.
HRESULT DrawAndFillRoundedRectangleExample::OnRender()
{
    HRESULT hr;

    // Create the render target and brushes if they
    // don't already exists.
    hr = CreateDeviceResources();

    if (SUCCEEDED(hr))
    {
        // Retrieve the size of the render target.
        D2D1_SIZE_F renderTargetSize = m_pRenderTarget->GetSize();

        m_pRenderTarget->BeginDraw();
        m_pRenderTarget->SetTransform(D2D1::Matrix3x2F::Identity());
        m_pRenderTarget->Clear(D2D1::ColorF(D2D1::ColorF::White));

        // Paint a grid background.
        m_pRenderTarget->FillRectangle(
            D2D1::RectF(0.0f, 0.0f, renderTargetSize.width, renderTargetSize.height),
            m_pGridPatternBitmapBrush
            );

        // Define a rounded rectangle.
        D2D1_ROUNDED_RECT roundedRect = D2D1::RoundedRect(
            D2D1::RectF(20.f, 20.f, 150.f, 100.f),
            10.f,
            10.f
            );

        // Draw the rectangle.
        m_pRenderTarget->DrawRoundedRectangle(roundedRect, m_pBlackBrush, 10.f);

        // Apply a translation transform.
        m_pRenderTarget->SetTransform(D2D1::Matrix3x2F::Translation(200.f, 0.f));

        // Draw the rounded rectangle again, this time with a dashed stroke.
        m_pRenderTarget->DrawRoundedRectangle(roundedRect, m_pBlackBrush, 10.f, m_pStrokeStyle);

        // Apply another translation transform.
        m_pRenderTarget->SetTransform(D2D1::Matrix3x2F::Translation(0.f, 150.f));

        // Draw, then fill the rounded rectangle.
        m_pRenderTarget->DrawRoundedRectangle(roundedRect, m_pBlackBrush, 10.f, m_pStrokeStyle);
        m_pRenderTarget->FillRoundedRectangle(roundedRect, m_pSilverBrush);

        // Apply another translation transform.
        m_pRenderTarget->SetTransform(D2D1::Matrix3x2F::Translation(200.f, 150.f));

        // Fill, then draw the rounded rectangle.
        m_pRenderTarget->FillRoundedRectangle(roundedRect, m_pSilverBrush);
        m_pRenderTarget->DrawRoundedRectangle(roundedRect, m_pBlackBrush, 10.f, m_pStrokeStyle);

        hr = m_pRenderTarget->EndDraw();

        if (hr == D2DERR_RECREATE_TARGET)
        {
            hr = S_OK;
            DiscardDeviceResources();
        }
    }

    return hr;
}

요구 사항

요구 사항
지원되는 최소 클라이언트 Windows 7, Windows Vista SP2 및 Windows Vista용 플랫폼 업데이트가 포함된 Windows Vista [데스크톱 앱 | UWP 앱]
지원되는 최소 서버 Windows Server 2008 R2, Windows Server 2008 SP2 및 Windows Server 2008용 플랫폼 업데이트 [데스크톱 앱 | UWP 앱]
대상 플랫폼 Windows
헤더 d2d1.h
라이브러리 D2d1.lib
DLL D2d1.dll

추가 정보

D2D1::RoundedRect

기본 도형을 그리고 채우는 방법

ID2D1RenderTarget