本文介绍了DrawArc角度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


我正在绘制一个圆角的矩形,但我对Graphics.DrawArc方法有疑问。


这是代码:

 private void DrawRoundedBorder(Graphics g,Rectangle rectangle,Brush brush)
{
float diameter = 2 * Radius - 厚度。所有;
float halfThickness = Thickness.All / 2;

if(diameter< = 0)
return;

钢笔=新钢笔(刷子,厚度。全部);

g.DrawArc(笔,矩形.X + halfThickness,rectangle.Y + halfThickness,直径,直径,180,90); // OK

g.DrawArc(笔,矩形。右 - 半厚度 - 2 *(半径 - 半厚度),矩形.Y + halfThickness,直径,直径,270,90); // OK
}

你能帮助我吗? (我无法发布任何图片或链接)


谢谢


解决方案

Hello,

i'm drawing a rectangle with rounded angles but i have a problem with the Graphics.DrawArc method.

Here is the code:

private void DrawRoundedBorder(Graphics g, Rectangle rectangle, Brush brush)
{
			float diameter = 2 * Radius - Thickness.All;
			float halfThickness = Thickness.All / 2;

			if (diameter <= 0)
				return;

			Pen pen = new Pen(brush, Thickness.All);

			g.DrawArc(pen, rectangle.X + halfThickness, rectangle.Y + halfThickness, diameter, diameter, 180, 90);	//OK

			g.DrawArc(pen, rectangle.Right - halfThickness - 2 * (Radius - halfThickness), rectangle.Y + halfThickness, diameter, diameter, 270, 90);	//OK
}

Can you help me? (I can't post any image or link)

Thanks

解决方案


这篇关于DrawArc角度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 07:40