Metode PathGradientBrush::GetCenterColor (gdipluspath.h)
Metode PathGradientBrush::GetCenterColor mendapatkan warna titik tengah dari jalur ini sikat gradien.
Sintaks
Status GetCenterColor(
[out] Color *color
);
Parameter
[out] color
Jenis: Warna*
Penunjuk ke objek Warna yang menerima warna titik tengah.
Menampilkan nilai
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 objek PathGradientBrush adalah sentroid jalur batas kuas, tetapi Anda dapat mengatur titik tengah ke lokasi mana pun, di dalam atau di luar jalur, dengan memanggil metode PathGradientBrush::SetCenterPoint Methods dari objek PathGradientBrush .
Contoh
Contoh berikut membuat objek PathGradientBrush dan menggunakannya untuk mengisi elips. Kemudian kode memanggil metode PathGradientBrush::GetCenterColor dari objek PathGradientBrush untuk mendapatkan warna tengah.
VOID Example_GetCenterColor(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);
// Fill the ellipse with the path gradient brush.
graphics.FillEllipse(&pthGrBrush, 0, 0, 200, 100);
// Obtain information about the path gradient brush.
Color color;
pthGrBrush.GetCenterColor(&color);
// Fill a rectangle with the retrieved color.
SolidBrush solidBrush(color);
graphics.FillRectangle(&solidBrush, 0, 120, 200, 30);
}
Persyaratan
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::GetCenterPoint Methods
Saran dan Komentar
https://aka.ms/ContentUserFeedback.
Segera hadir: Sepanjang tahun 2024 kami akan menghentikan penggunaan GitHub Issues sebagai mekanisme umpan balik untuk konten dan menggantinya dengan sistem umpan balik baru. Untuk mengetahui informasi selengkapnya, lihat:Kirim dan lihat umpan balik untuk