简体   繁体   English

如何在c#中绘制一个带有间隙的圆圈

[英]How to draw a circle with a gap in c#

I am currently trying to display a circle in c# which is cut(has a gap and it's not finished). 我目前正在尝试在c#中显示一个被切割的圆圈(有一个间隙而且还没有完成)。 Is it possible to do this in c# directly or do I need to use some kind of photoshop? 有可能直接在c#中执行此操作,还是需要使用某种类型的photoshop?

An example of how it should look like is here : 它应该是什么样子的一个例子如下:

界

I am trying to utilise this in order to code a program for medical diagnosis. 我正在尝试利用它来编写医疗诊断程序。 The Circle with gap will increase in size or decrease. 具有间隙的圆将增大或减小。 Thanks! 谢谢!

you probably mean this: 你可能是这个意思

        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
            e.Graphics.DrawArc(new Pen(Brushes.Black, 8), new Rectangle(50, 50, 100, 100), 10, 340);
        }

The last 2 values(10 and 340 in this case),are the start angle and sweep angle. 最后2个值(在这种情况下为10和340)是起始角度和扫掠角度。

EDIT: 编辑:

To place the flat like ending fill a rectangle on top with the forms backcolor: 要像平底一样放置平面,在顶部填充一个矩形,背景为:

        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
            e.Graphics.DrawArc(new Pen(Brushes.Black, 10), new Rectangle(50, 50, 100,100),10, 340);
            e.Graphics.FillRectangle(new SolidBrush(this.BackColor), new Rectangle(142, 85, 14, 30));
        }

For the other ones you will have to play with the coordinates:). 对于其他人,你将不得不使用坐标:)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM