Share via


Region::GetBounds(Rect*,constGraphics*) 메서드(gdiplusheaders.h)

Region::GetBounds 메서드는 이 지역을 둘러싸는 사각형을 가져옵니다.

구문

Status GetBounds(
  Rect           *rect,
  const Graphics *g
);

매개 변수

rect

바깥쪽 사각형을 수신하는 Rect 개체에 대한 포인터입니다.

g

이 영역 및 사각형의 디바이스 좌표를 계산하는 데 필요한 월드 및 페이지 변환을 포함하는 Graphics 개체에 대한 포인터입니다.

반환 값

형식: 상태

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

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

설명

그래픽 개체의 현재 세계 및 페이지 변환은 디스플레이 디바이스에 그려질 때 영역과 사각형을 계산하는 데 사용됩니다. Region::GetBounds에서 반환된 사각형이 항상 가능한 가장 작은 사각형은 아닙니다.

예제

다음 예제에서는 경로에서 영역을 만들고 영역의 바깥쪽 사각형을 가져오고 두 영역을 모두 표시합니다.

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

   Point points[] = {
      Point(110, 20),
      Point(120, 30),
      Point(100, 60),
      Point(120, 70),
      Point(150, 60),
      Point(140, 10)};

   GraphicsPath path;
    SolidBrush solidBrush(Color(255, 255, 0, 0));
    Pen pen(Color(255, 0, 0, 0));
    Rect rect;

   path.AddClosedCurve(points, 6);

    // Create a region from a path.
    Region pathRegion(&path);

    // Get the region's enclosing rectangle.
    pathRegion.GetBounds(&rect, &graphics);

    // Show the region and the enclosing rectangle.
    graphics.FillRegion(&solidBrush, &pathRegion);
    graphics.DrawRectangle(&pen, rect);
}

요구 사항

   
머리글 gdiplusheaders.h

참고 항목

지역

Graphicspath

Rect

상태