Graphics::GetClipBounds(Rect*) 메서드(gdiplusgraphics.h)

Graphics::GetClipBounds 메서드는 이 Graphics 개체의 클리핑 영역을 묶는 사각형을 가져옵니다.

구문

Status GetClipBounds(
  [out] Rect *rect
);

매개 변수

[out] rect

형식: Rect*

클리핑 영역을 묶는 사각형을 수신하는 Rect 개체에 대한 포인터입니다.

반환 값

형식: 상태

메서드가 성공하면 Status 열거형의 요소인 Ok를 반환합니다.

메서드가 실패하면 Status 열거형의 다른 요소 중 하나를 반환합니다.

설명

월드 변환이 클리핑 영역에 적용된 다음, 바깥쪽 사각형이 계산됩니다.

Graphics 개체의 클리핑 영역을 명시적으로 설정하지 않으면 해당 클리핑 영역은 무한합니다. 클리핑 영역이 무한하면 Graphics::GetClipBounds 는 큰 사각형을 반환합니다. 해당 사각형의 XY 데이터 멤버는 큰 음수이고 WidthHeight 데이터 멤버는 양수입니다.

예제

다음은 클리핑 영역을 설정하고 클리핑 영역을 묶는 사각형을 가져오고 사각형을 채우는 예제입니다.

VOID Example_GetClipBounds(HDC hdc)
{
   Graphics graphics(hdc);

   Region   myRegion(Rect(25, 25, 100, 50));
   Rect     rect(40, 60, 100, 50);
   Region   gRegion;
   Rect     enclosingRect;

   SolidBrush  blueBrush(Color(100, 0, 0, 255));
   Pen         greenPen(Color(255, 0, 255, 0), 1.5f);

   // Modify the region by using a rectangle.
   myRegion.Union(rect);

   // Set the clipping region of the graphics object.
   graphics.SetClip(&myRegion);

   // Now, get the clipping region, and fill it.
   graphics.GetClip(&gRegion);
   graphics.FillRegion(&blueBrush, &gRegion);

   // Get a rectangle that encloses the clipping region, and draw the enclosing
   // rectangle.
   graphics.GetClipBounds(&enclosingRect);
   graphics.ResetClip();
   graphics.DrawRectangle(&greenPen, enclosingRect);}

요구 사항

요구 사항
지원되는 최소 클라이언트 Windows XP, Windows 2000 Professional [데스크톱 앱만 해당]
지원되는 최소 서버 Windows 2000 Server[데스크톱 앱만]
대상 플랫폼 Windows
헤더 gdiplusgraphics.h(Gdiplus.h 포함)
라이브러리 Gdiplus.lib
DLL Gdiplus.dll

추가 정보

클리핑

지역을 사용하여 클리핑

GetVisibleClipBounds 메서드

그래픽

그래픽::GetClip

Rect

SetClip 메서드

상태