Metode PathGradientBrush::SetCenterPoint(constPointF&) (gdipluspath.h)

Metode PathGradientBrush::SetCenterPoint mengatur titik tengah sikat gradien jalur ini. Secara default, titik tengah berada di sentroid jalur batas kuas, tetapi Anda dapat mengatur titik pusat ke lokasi mana pun di dalam atau di luar jalur.

Sintaks

Status SetCenterPoint(
  const PointF & point
);

Parameter

point

Referensi ke objek PointF yang menentukan titik tengah.

Nilai kembali

Tipe:Status

Jika metode berhasil, metode mengembalikan Ok, yang merupakan elemen dari enumerasi Status .

Jika metode gagal, metode mengembalikan salah satu elemen lain dari enumerasi Status .

Keterangan

Contoh

Contoh berikut membuat objek PathGradientBrush berdasarkan elips. Kode mengatur warna tengah menjadi biru dan mengatur warna di sepanjang batas ke aqua. Secara default, titik tengah akan berada di tengah elips (100, 50), tetapi panggilan ke metode PathGradientBrush::SetCenterPoint mengatur titik tengah ke (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);
}

Persyaratan

Persyaratan Nilai
Header gdipluspath.h

Lihat juga

Kuas dan Bentuk Terisi

Membuat Gradien Jalur

Mengisi Bentuk dengan Gradien Warna

GraphicsPath

PathGradientBrush

PathGradientBrush::GetCenterColor

PathGradientBrush::GetCenterPoint Methods

PathGradientBrush::SetCenterColor