PointF 構造体で指定された点の配列によって定義される多角形の内部を指定の塗りつぶしモードで塗りつぶします。
Overloads Public Sub FillPolygon( _
ByVal brush As Brush, _ ByVal points() As PointF, _ ByVal fillMode As FillMode _)
[C#]
public void FillPolygon(Brushbrush,PointF[] points,FillModefillMode);
[C++]
public: void FillPolygon(Brush* brush,PointFpoints[],FillModefillMode);
[JScript]
public function FillPolygon(
brush : Brush,points : PointF[],fillMode : FillMode);
パラメータ
- brush
塗りつぶしの特性を決定する Brush オブジェクト。 - points
塗りつぶす多角形の頂点を表す PointF 構造体の配列。 - fillMode
塗りつぶしのスタイルを決定する FillMode 列挙体のメンバ。
戻り値
このメソッドは値を返しません。
解説
配列内の連続する 2 つの点は、それぞれ多角形の辺を指定します。また、最後の点と最初の点が一致しない場合は、多角形を閉じる辺を指定します。
使用例
[Visual Basic, C#] 次の例は、Windows フォームでの使用を意図してデザインされており、 Paint イベント ハンドラのパラメータである PaintEventArgs e が必要です。このコードでは次のアクションを実行します。
- 青いソリッド ブラシを作成します。
- 多角形を定義する 7 点の配列を作成します。
- 塗りつぶしモードを FillMode.Winding に設定します。
- 画面の多角形領域を塗りつぶします。
Public Sub FillPolygonPointFFillMode(e As PaintEventArgs)
' Create solid brush.
Dim blueBrush As New SolidBrush(Color.Blue)
' Create points that define polygon.
Dim point1 As New PointF(50F, 50F)
Dim point2 As New PointF(100F, 25F)
Dim point3 As New PointF(200F, 5F)
Dim point4 As New PointF(250F, 50F)
Dim point5 As New PointF(300F, 100F)
Dim point6 As New PointF(350F, 200F)
Dim point7 As New PointF(250F, 250F)
Dim curvePoints As PointF() = {point1, point2, point3, point4, _
point5, point6, point7}
' Define fill mode.
Dim newFillMode As FillMode = FillMode.Winding
' Fill polygon to screen.
e.Graphics.FillPolygon(blueBrush, curvePoints, newFillMode)
End Sub
[C#]
public void FillPolygonPointFFillMode(PaintEventArgs e)
{
// Create solid brush.
SolidBrush blueBrush = new SolidBrush(Color.Blue);
// Create points that define polygon.
PointF point1 = new PointF( 50.0F, 50.0F);
PointF point2 = new PointF(100.0F, 25.0F);
PointF point3 = new PointF(200.0F, 5.0F);
PointF point4 = new PointF(250.0F, 50.0F);
PointF point5 = new PointF(300.0F, 100.0F);
PointF point6 = new PointF(350.0F, 200.0F);
PointF point7 = new PointF(250.0F, 250.0F);
PointF[] curvePoints =
{
point1,
point2,
point3,
point4,
point5,
point6,
point7
};
// Define fill mode.
FillMode newFillMode = FillMode.Winding;
// Fill polygon to screen.
e.Graphics.FillPolygon(blueBrush, curvePoints, newFillModex3);
}
[C++, JScript] C++ および JScript のサンプルはありません。Visual Basic および C# のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ
参照
Graphics クラス | Graphics メンバ | System.Drawing 名前空間 | Graphics.FillPolygon オーバーロードの一覧