GraphicsPath::IsVisible (constPointF&,constGraphics*) 方法 (gdipluspath.h)
GraphicsPath::IsVisible 方法會決定指定的點是否位於指定的 Graphics 物件填滿此路徑時所填滿的區域。
語法
BOOL IsVisible(
const PointF & point,
const Graphics *g
);
參數
point
要測試之點的參考。
g
選擇性。 指定世界對裝置轉換之 Graphics 物件的指標。 如果此參數的值是 NULL,則會以世界座標完成測試;否則,測試會在裝置座標中完成。 預設值是 NULL。
傳回值
如果測試點位於此路徑的內部,這個方法會傳回 TRUE;否則會傳回 FALSE。
備註
範例
下列範例會建立橢圓形路徑,並使用窄黑色畫筆繪製該路徑。 然後,程式代碼會測試陣列中的每個點,以查看該點是否位於路徑的內部。 位於內部的點會繪製綠色,而不在內部的點則會繪製紅色。
VOID IsVisibleExample(HDC hdc)
{
Graphics graphics(hdc);
INT j;
Pen blackPen(Color(255, 0, 0, 0), 1);
SolidBrush brush(Color(255, 255, 0, 0));
// Create and draw a path.
GraphicsPath path;
path.AddEllipse(50, 50, 200, 100);
graphics.DrawPath(&blackPen, &path);
// Create an array of four points, and determine whether each
// point in the array touches the outline of the path.
// If a point touches the outline, paint it green.
// If a point does not touch the outline, paint it red.
PointF[] = {
PointF(50, 100),
PointF(250, 100),
PointF(150, 170),
PointF(180, 60)};
for(j = 0; j <= 3; ++j)
{
if(path.IsVisible(points[j], &graphics))
brush.SetColor(Color(255, 0, 255, 0));
else
brush.SetColor(Color(255, 255, 0, 0));
graphics.FillEllipse(&brush, points[j].X - 3.0f, points[j].Y - 3.0f, 6.0f, 6.0f);
}
}
規格需求
標頭 | gdipluspath.h |