ここで定義した四角形の延長方法を実装しました。私はそう g.DrawRRectangle(p, 100, 100, 1000, 1000, 100);
、 のようにこの方法を使用する場合ベジエ曲線を他の図に結合する
public static Graphics DrawRRectangle(this Graphics g, Pen p, int x, int y, int width, int height, int feathering)
{
g.DrawLine(p, x, y + feathering, x, y + height - feathering);
g.DrawBezier(p, new Point(x, y + height - feathering),
new Point(x, y + height - feathering/2), new Point(x + feathering/2, y + height),
new Point(x + feathering, y + height));
g.DrawLine(p, x + feathering, y + height , x + width - feathering, y + height);
g.DrawBezier(p, new Point(x + width - feathering, y + height),
new Point(x + width - feathering/2, y + height), new Point(x + width, y + height - feathering/2),
new Point(x + width, y + height - feathering));
g.DrawLine(p, x + width, y + height - feathering, x + width, y + feathering);
g.DrawBezier(p, new Point(x + width, y + feathering),
new Point(x + width, y + feathering/2), new Point(x + width - feathering/2, y),
new Point(x + width - feathering, y));
g.DrawLine(p, x + width - feathering, y, x + feathering, y);
g.DrawBezier(p, new Point(x + feathering, y),
new Point(x + feathering/2, y), new Point(x, y + feathering/2),
new Point(x, y + feathering));
return g;
}
は、しかし、私は私が望んでいた結果を得ることはありません、コーナーのそれぞれは、下の画像に見られるように、そのピクセルのずれのいずれかが一致しないです。
誰もが提供できる任意の提案を参考になる、これはしかし、これは私が手を染めています初めて私の曲線を生成するために使用される方程式の問題をされている場合、私はわかりませんよグラフィックスがあるので、それは私の考えである可能性があります。ありがとう。
丸みのある四角形を描くには、より良い方法があります。 – series0ne
https://web.archive.org/web/20111110163706/http://www.switchonthecode.com/tutorials/csharp-creating-rounded-rectangles-using -a-graphics-path – series0ne
http://stackoverflow.com/questions/19167463/oddly-drawn-graphicspath-with-graphics-fillpath – series0ne