以下のコードを使用すると、矢印型のボタン(下に表示)を描画できますが、ボタン画像としてサイズ175x154のpng画像を使用できるように、六角形(下に結果画像として表示)を描画したいのですが、どのポイントを使用する必要がありますか?これを描くには?そして、そのようなボタンを6つ描く必要がありますが、どうすればこれを達成できますか?
private void Parent_Load(object sender, EventArgs e)
{
// Define the points in the polygonal path.
Point[] pts = {
new Point( 20, 60),
new Point(140, 60),
new Point(140, 20),
new Point(220, 100),
new Point(140, 180),
new Point(140, 140),
new Point( 20, 140)
};
// Make the GraphicsPath.
GraphicsPath polygon_path = new GraphicsPath(FillMode.Winding);
polygon_path.AddPolygon(pts);
// Convert the GraphicsPath into a Region.
Region polygon_region = new Region(polygon_path);
// Constrain the button to the region.
btnExam.Region = polygon_region;
// Make the button big enough to hold the whole region.
btnExam.SetBounds(
btnExam.Location.X,
btnExam.Location.Y,
pts[3].X + 5, pts[4].Y + 5);
}