如何在VB.NET中绘制圆弧 [英] How to draw circular arcs in VB.NET

查看:402
本文介绍了如何在VB.NET中绘制圆弧的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须根据用户输入的值生成下图.给定圆弧的起点和起点,我该如何绘制圆弧(如图中的B-C-F,本质上是圆形).端点(分别为B和F)和距段BF的高度?我可以进行一些几何计算得到半径&全部,但是如何绘制圆弧?

I have to generate the following figure according to user fed values. How do I go about drawing the arcs (B-C-F as in figure, circular in nature) given their start point & end point (B & F respectively) & the height from the segment BF? I can do some geometric calculations & get the radius & all, but how do I draw the arc?

我尝试使用Graphics.DrawCurve()方法,但是它没有按预期工作.如何使此方法适用于圆弧?也欢迎任何其他解决方法.

I have tried using the Graphics.DrawCurve() method, but it doesn't work as expected. How can I make this method work for circular arcs? Any other workaround is also welcome.

推荐答案

知道了!谢谢@Mitch& @Idle_Mind

Got it! Thanks @Mitch & @Idle_Mind

使用Graphics

Friend Function draw_tank() As Boolean

    ' Create pen. 
    Dim blackPen As New Pen(Color.Black, 3)

    ' Create rectangle to bound ellipse. 
    Dim rect As New Rectangle(100, 100, 200, 200)
    ' Keeping the width & length same (200) we get a circle

    ' Create start and sweep angles on ellipse. 
    Dim startAngle As Single = 225.0F
    Dim sweepAngle As Single = 90.0F

    ' Draw arc to screen.
    Dim myarc As Graphics = Me.CreateGraphics
    myarc.DrawArc(blackPen, rect, startAngle, sweepAngle)

    Return True
End Function

建议/改进.

注意-这不是我代码中的实际功能.

Note - This isn't the actual function from my code.

这篇关于如何在VB.NET中绘制圆弧的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆