Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cassandra/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
尝试在VB.net应用程序中创建千分表_Vb.net_Gauge - Fatal编程技术网

尝试在VB.net应用程序中创建千分表

尝试在VB.net应用程序中创建千分表,vb.net,gauge,Vb.net,Gauge,我一直在周而复始地试图弄明白如何将拨号控件合并到Windows窗体中(而不必购买第三方解决方案)。根据我所做的研究,似乎我需要microsoft.toolkit.uwp.ui.controls。我试图安装版本6.1.1(从.nupkg),但收到以下安装错误:“无法安装程序包'Microsoft.Toolkit.Uwp.UI.Controls 6.1.1'。您正试图将此软件包安装到以“.NETFramework,Version=v4.7.2”为目标的项目中,但该软件包不包含任何与该框架兼容的程序集

我一直在周而复始地试图弄明白如何将拨号控件合并到Windows窗体中(而不必购买第三方解决方案)。根据我所做的研究,似乎我需要microsoft.toolkit.uwp.ui.controls。我试图安装版本6.1.1(从.nupkg),但收到以下安装错误:“无法安装程序包'Microsoft.Toolkit.Uwp.UI.Controls 6.1.1'。您正试图将此软件包安装到以“.NETFramework,Version=v4.7.2”为目标的项目中,但该软件包不包含任何与该框架兼容的程序集引用或内容文件。“欢迎提供任何指导/帮助。

谢谢Jimi。链接(Arc图形质量)工作起来很有魅力。我需要做一些调整才能让它与VB一起工作,但它可以工作。我已经附加了VB代码`

导入System.Drawing.Drawing2D

公开课表格1

Dim GaugeValue As Single = 75 'move the needle with this value (0 - 100 percent)
Dim GaugeSweepAngle As Single = 270
Dim GaugeStartAngle As Single = 135

Private Sub Canvas_Paint(sender As Object, e As PaintEventArgs) Handles Canvas.Paint
    Dim canvas As New Control
    e.Graphics.SmoothingMode = SmoothingMode.AntiAlias
    Dim outerRectangle = New Rectangle(10, 10, 180, 180)
    Dim innerRectangle = New Rectangle(30, 30, 140, 140)
    Dim blendRectangle = New Rectangle(10, 10, 180, 160)
    Dim innerCenter = New PointF(outerRectangle.Left + (outerRectangle.Width / 2), outerRectangle.Top + (outerRectangle.Height / 2))
    Dim gaugeLength = (outerRectangle.Width / 2) - 2

    Using Path = New GraphicsPath
        Path.AddPie(outerRectangle, GaugeStartAngle, GaugeSweepAngle)
        Path.AddPie(innerRectangle, GaugeStartAngle, GaugeSweepAngle)
        innerRectangle.Inflate(-1, -1)

        Using pen = New Pen(Color.Black, 3.0F)
            Using backgroundbrush = New SolidBrush(canvas.BackColor)
                Using gradientBrush = New LinearGradientBrush(blendRectangle, Color.Green, Color.Red, LinearGradientMode.ForwardDiagonal)
                    Dim blend = New Blend
                    Dim factors(0.0, 0.0, 0.1, 0.3, 0.7, 1.0)
                    Dim positions(0.0, 0.2, 0.4, 0.6, 0.8, 1.0)

                    gradientBrush.Blend = blend
                    e.Graphics.FillPath(gradientBrush, Path)
                    e.Graphics.DrawPath(pen, Path)
                    e.Graphics.FillEllipse(backgroundbrush, innerRectangle)

                    Using format = New StringFormat
                        format.Alignment = StringAlignment.Center
                        format.LineAlignment = StringAlignment.Center
                        innerRectangle.Location = New Point(innerRectangle.X, innerRectangle.Y + canvas.Font.Height)
                        e.Graphics.DrawString(GaugeValue.ToString() + "%", canvas.Font, Brushes.Black, innerRectangle, format)

                        Using mx = New Matrix
                            mx.RotateAt(GaugeStartAngle + 90 + (GaugeValue * (GaugeSweepAngle / 100)), innerCenter)
                            e.Graphics.Transform = mx
                            e.Graphics.DrawLine(pen, innerCenter, New PointF(innerCenter.X, innerCenter.Y - gaugeLength))
                            e.Graphics.ResetTransform()
                        End Using
                    End Using
                End Using
            End Using
        End Using
    End Using

End Sub

End Class`.

。非常原始的设计(风格不是重点),但基本功能就在那里。您可能对.net中的notes.I Google“千分表”更感兴趣“免费点击了几次。谢谢你的反馈Jimi/Mary。我在谷歌上搜索过同样的东西。“免费”解决方案有点误导。它们最终成为免费试用。我会试试吉米的建议。