次の方法で共有


Graphics.FillPolygon メソッド (Brush, Point )

Point 構造体で指定された点の配列によって定義される多角形の内部を塗りつぶします。

Overloads Public Sub FillPolygon( _
   ByVal brush As Brush, _   ByVal points() As Point _)
[C#]
public void FillPolygon(Brushbrush,Point[] points);
[C++]
public: void FillPolygon(Brush* brush,Pointpoints[]);
[JScript]
public function FillPolygon(
   brush : Brush,points : Point[]);

パラメータ

  • brush
    塗りつぶしの特性を決定する Brush オブジェクト。
  • points
    塗りつぶす多角形の頂点を表す Point 構造体の配列。

戻り値

このメソッドは値を返しません。

解説

配列内の連続する 2 つの点は、それぞれ多角形の辺を指定します。また、最後の点と最初の点が一致しない場合は、多角形を閉じる辺を指定します。

使用例

[Visual Basic, C#] 次の例は、Windows フォームでの使用を意図してデザインされており、 Paint イベント ハンドラのパラメータである PaintEventArgs e が必要です。このコードは次のアクションを実行します。

  • 青いソリッド ブラシを作成します。
  • 多角形を定義する 7 点の配列を作成します。
  • 画面の多角形領域を塗りつぶします。
 
Public Sub FillPolygonPoint(e As PaintEventArgs)
' Create solid brush.
Dim blueBrush As New SolidBrush(Color.Blue)
' Create points that define polygon.
Dim point1 As New Point(50, 50)
Dim point2 As New Point(100, 25)
Dim point3 As New Point(200, 5)
Dim point4 As New Point(250, 50)
Dim point5 As New Point(300, 100)
Dim point6 As New Point(350, 200)
Dim point7 As New Point(250, 250)
Dim curvePoints As Point() =  {point1, point2, point3, point4, _
point5, point6, point7}
' Draw polygon to screen.
e.Graphics.FillPolygon(blueBrush, curvePoints)
End Sub
        
[C#] 
public void FillPolygonPoint(PaintEventArgs e)
{
// Create solid brush.
SolidBrush blueBrush = new SolidBrush(Color.Blue);
// Create points that define polygon.
Point point1 = new Point( 50,  50);
Point point2 = new Point(100,  25);
Point point3 = new Point(200,   5);
Point point4 = new Point(250,  50);
Point point5 = new Point(300, 100);
Point point6 = new Point(350, 200);
Point point7 = new Point(250, 250);
Point[] curvePoints =
{
point1,
point2,
point3,
point4,
point5,
point6,
point7
};
// Draw polygon to screen.
e.Graphics.FillPolygon(blueBrush, curvePoints);
}
        

[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 ファミリ, .NET Compact Framework - Windows CE .NET

参照

Graphics クラス | Graphics メンバ | System.Drawing 名前空間 | Graphics.FillPolygon オーバーロードの一覧