여기에 정의 된 둥근 사각형 확장 방법을 구현했습니다. 내가 그렇게 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