Catatan
Akses ke halaman ini memerlukan otorisasi. Anda dapat mencoba masuk atau mengubah direktori.
Akses ke halaman ini memerlukan otorisasi. Anda dapat mencoba mengubah direktori.
Metode PathGradientBrush::SetCenterColor mengatur warna tengah kuas gradien jalur ini. Warna tengah adalah warna yang muncul di titik tengah kuas.
Sintaks
Status SetCenterColor(
[in, ref] const Color & color
);
Parameter
[in, ref] color
Jenis: Const Color
Referensi ke objek Warna yang menentukan warna tengah.
Nilai kembali
Jenis: 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
Secara default, titik tengah adalah sentroid jalur batas kuas, tetapi Anda dapat mengatur titik pusat ke lokasi mana pun di dalam atau di luar jalur.
Contoh
Contoh berikut membuat objek PathGradientBrush berdasarkan elips. Kode memanggil metode PathGradientBrush::SetCenterColor dari objek PathGradientBrush untuk mengatur warna tengah ke biru. Metode PathGradientBrush::SetSurroundColors mengatur warna di sepanjang batas ke aqua. Metode FillRectangle Methods menggunakan kuas gradien jalur untuk melukis persegi panjang yang berisi elips.
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 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 |
|---|---|
| Klien minimum yang didukung | Windows XP, Windows 2000 Professional [hanya aplikasi desktop] |
| Server minimum yang didukung | Windows 2000 Server [hanya aplikasi desktop] |
| Target Platform | Windows |
| Header | gdipluspath.h (termasuk Gdiplus.h) |
| Pustaka | Gdiplus.lib |
| DLL | Gdiplus.dll |
Lihat juga
Mengisi Bentuk dengan Gradien Warna
PathGradientBrush::GetCenterColor