丸い長方形と、下の画像で緑色で丸で囲んだ底にあるものでポップアップバブルを作成しようとしています:
しかし、あなたが推測したように、これは私が望む方法ではなく、代わりに:
必要に応じて描画する方法を見つけましたが、その場合、パスの周りに境界線を追加すると、その小さな三角形と丸い長方形が分離されます。
私が使用しているコードは次のとおりです。
public static GraphicsPath CreateBubblePath(Rectangle rect, int radius)
{
GraphicsPath p = new GraphicsPath();
GraphicsPath p2 = new GraphicsPath();
p.StartFigure();
p2.StartFigure();
int pointHeigt = 3 * radius;
//Top Left Corner
p.AddArc(rect.X, rect.Y, 2 * radius, 2 * radius, 180, 90);
//Top Edge
p.AddLine(rect.X + radius, rect.Y, rect.X + rect.Width - radius, rect.Y);
//Top Right Corner
p.AddArc(rect.X + rect.Width - 2 * radius, rect.Y, 2 * radius, 2 * radius, 270, 90);
//Right Edge
p.AddLine(rect.X + rect.Width, rect.Y + radius, rect.X + rect.Width, rect.Y + rect.Height - radius - pointHeigt);
//Bottom Right Corner
p.AddArc(rect.X + rect.Width - (2 * radius), rect.Y + rect.Height - radius - pointHeigt, 2 * radius, 2 * radius, 0, 90);
//Bottom Edge 1/2
//METHOD 1
p.AddLine(rect.X + rect.Width - radius, rect.Y + rect.Height - 2 * radius, rect.X + (rect.Width / 2) + pointHeigt, rect.Y + rect.Height - 2 * radius);
p.AddArc(rect.X + (rect.Width / 2), rect.Y + rect.Height - 2 * radius , pointHeigt, pointHeigt, 180, 90);
p.AddArc(rect.X + (rect.Width / 2) - pointHeigt, rect.Y + rect.Height - 2 * radius, pointHeigt, pointHeigt, 270, 90);
p.AddLine(rect.X + (rect.Width / 2) - pointHeigt, rect.Y + rect.Height - 2 * radius, rect.X + radius, rect.Y + rect.Height - 2 * radius);
//METHOD 2///////////////////////////////////////
//p.AddLine(rect.X + rect.Width - radius, rect.Y + rect.Height - 2 * radius, rect.X + radius, rect.Y + rect.Height - 2 * radius);
//p2.AddArc(rect.X + (rect.Width / 2), rect.Y + rect.Height - 2 * radius, pointHeigt, pointHeigt, 180, 90);
//p2.AddArc(rect.X + (rect.Width / 2) - pointHeigt, rect.Y + rect.Height - 2 * radius, pointHeigt, pointHeigt, 270, 90);
//p2.CloseFigure();
////////////////////////////////
//Bottom Left Corner
p.AddArc(rect.X, rect.Y + rect.Height - radius - pointHeigt, 2 * radius, 2 * radius, 90, 90);
//Left Edge
p.AddLine(rect.X, rect.Y + rect.Height - radius - pointHeigt, rect.X, rect.Y + radius);
p.CloseFigure();
//METHOD 2
//p.AddPath(p2, true);
return p;
}