다음을 통해 공유


PathGradientBrush::SetCenterPoint(constPointF&) 메서드(gdipluspath.h)

PathGradientBrush::SetCenterPoint 메서드는 이 경로 그라데이션 브러시의 중심점을 설정합니다. 기본적으로 중심점은 브러시 경계 경로의 중심이지만 경로 내부 또는 외부의 모든 위치로 중심점을 설정할 수 있습니다.

통사론

Status SetCenterPoint(
  const PointF & point
);

매개 변수

point

중심점을 지정하는 PointF 개체에 대한 참조입니다.

반환 값

유형:상태

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

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

발언

예제

다음 예제에서는 타원을 기반으로 PathGradientBrush 개체를 만듭니다. 코드는 가운데 색을 파란색으로 설정하고 경계를 따라 색을 아쿠아로 설정합니다. 기본적으로 중심점은 줄임표(100, 50)의 가운데에 있지만 PathGradientBrush::SetCenterPoint 메서드에 대한 호출은 중심점을 (180.5, 50.0)으로 설정합니다.

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

   // Create a path that consists of a single ellipse.
   GraphicsPath path;
   path.AddEllipse(0, 0, 200, 100);

   // Use the path to construct a brush.
   PathGradientBrush pthGrBrush(&path);

   // Set the color at the center of the path to blue.
   pthGrBrush.SetCenterColor(Color(255, 0, 0, 255));

   // Set the center point.
   pthGrBrush.SetCenterPoint(PointF(180.5f, 50.0f));

   // Set the color along the entire boundary of the path to aqua.
   Color colors[] = {Color(255, 0, 255, 255)};
   INT count = 1;
   pthGrBrush.SetSurroundColors(colors, &count);

   graphics.FillRectangle(&pthGrBrush, 0, 0, 300, 300);
}

요구 사항

요구
헤더 gdipluspath.h

참고 항목

브러시 및 채워진 도형

경로 그라데이션 만들기

색 그라데이션 도형 채우기

GraphicsPath

PathGradientBrush

PathGradientBrush::GetCenterColor

PathGradientBrush::GetCenterPoint 메서드

PathGradientBrush::SetCenterColor