资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

关于vb.net仪表盘源码的信息

如何用vb.net获得网页的源代码

Dim url As String=" 网址"

成都创新互联公司成立10多年来,这条路我们正越走越好,积累了技术与客户资源,形成了良好的口碑。为客户提供成都网站制作、做网站、网站策划、网页设计、申请域名、网络营销、VI设计、网站改版、漏洞修补等服务。网站是否美观、功能强大、用户体验好、性价比高、打开快等等,这些对于网站建设都非常重要,成都创新互联公司通过对建站技术性的掌握、对创意设计的研究为客户提供一站式互联网解决方案,携手广大客户,共同发展进步。

Dim httpReq As System.Net.HttpWebRequest

Dim httpResp As System.Net.HttpWebResponse

Dim httpURL As New System.Uri(url)

httpReq = CType(WebRequest.Create(httpURL), HttpWebRequest)

httpReq.Method = "GET"

httpResp = CType(httpReq.GetResponse(), HttpWebResponse)

httpReq.KeepAlive = False ' 获取或设置一个值,该值指示是否与

Internet资源建立持久连接。

Dim reader As StreamReader = _

New StreamReader(httpResp.GetResponseStream,

System.Text.Encoding.GetEncoding(-0))

Dim respHTML As String = reader.ReadToEnd() 'respHTML就是网页源代码

VB.NET如何让仪表指针绕某点旋转

你把问题想简单点,直接在PANEL空间上使用GD+画指针就行了。算出两点划线还不容易么?用图片的话需要旋转,而且锯齿非常严重@!

下载的.net源码怎么运行?

如果你的计算机安装了.Net环境的话,(Vista以上版本都默认安装了,XP需要下载.Net Framework来安装),系统盘上Windows目录下会有一个Microsoft.Net目录,里面的2.0目录里有相应的编译器。C#语言的编译器是csc.exe,VB.Net语言的编译器是vbc.exe。用命令行的方式就能把源码编译成可执行程序。如csc 123.cs 123.exe。你也可以用集成开发环境,如VS2005或VS2008,用他们打开源码,并添加一个解决方案,就能编译并调试执行。不过VS2005或VS2008都比较大,几个G大小,另外还有一个比较小巧又好用的集成开发环境叫SharpDevelop,只有十几M大小,他和VS2005几乎一样好用,并能生产支持Vista界面的程序,不过只能编译C#源码。

VB.NET设计的窗体程序,有什么控件可以实现类似这种下载列表一样的?

如果是.NET平台的,你可以使用ComponentOne Enterprise 全功能.NET控件集中的布局控件实现。也可以试试ComponentOne的LinearGauge 控件,这是一个线性仪表器,显示为一个值和象征参考值的可选范围。线性仪表盘(LinearGauge)控件提供了一个 ShowText 属性,用来决定哪些值以文本显示。

》》传送门:网页链接

vb.net开发简单的时钟程序??高手救救我!

Hand类的代码:

Public MustInherit Class Hand

Protected gp As GraphicsPath = New GraphicsPath()

Protected gpBase As GraphicsPath = Nothing

Protected midX As Integer = 150 ‘默认的窗体

Protected midY As Integer = 150 ‘中心位置

‘构造器,得到窗体中心位置

Public Sub New(ByVal theForm As Form1)

midX = (theForm.ClientRectangle.Left + theForm.ClientRectangle.Right) / 2

midY = (theForm.ClientRectangle.Top + theForm.ClientRectangle.Bottom) / 2

End Sub

MustOverride Sub Transform(ByVal d As DateTime)

‘绘制指针路径

Overridable Sub Draw(ByVal g As Graphics)

Dim aPen As Pen = New Pen(Brushes.Black, 4F)

g.DrawPath(aPen, gp)

g.FillPath(Brushes.Black, gp)

aPen.Dispose()

End Sub

‘使用矩阵实现路径(gp)的旋转

Public Sub Rotate(ByVal angle As Double)

gp = CType(gpBase.Clone(), GraphicsPath)

Dim mTransform As Matrix = New Matrix()

mTransform.RotateAt(CType(angle,Single),NewPointF(midX,midY))

gp.Transform(mTransform)

End Sub

End Class

为了节省篇幅,上面的代码省略了引入命名空间的语句。

下面是分针(MinuteHand)类的定义:

Public Class MinuteHand

Inherits Hand

‘构造器,生成绘制分针的路径(gp)

Public Sub New(ByVal myForm As Form1)

MyBase.New(myForm)

gp.AddLine(midX, midY, midX, 45)

gp.AddLine(midX, 45, midX - 3, 50)

gp.AddLine(midX - 3, 50, midX + 3, 50)

gp.AddLine(midX + 3, 50, midX, 45)

gpBase = CType(gp.Clone(), GraphicsPath)

End Sub

‘Transform方法取得系统当前时间,并旋转时钟指针。

Public Overrides Sub Transform(ByVal d As DateTime)

Dim minuteTime As Double = (CDbl(d.Minute) + CDbl(d.Second / 60))

Dim angle As Double = (CDbl(minuteTime) / 60) * 360

Rotate(angle)

End Sub

End Class

对所有的指针旋转的方法都是相同的,因此在基类中实现。由于时针和秒针的实现与分针相似,所不同者,只在于构造器中绘制的指针路径不同和Transform方法中转动的角度不同,在这里就不在赘述了。

另外还需要提一下的是画时钟表面的代码,时钟表面用ClockFace类来实现。这个类首先画一个圆代表时钟,然后画上米老鼠的图案,最后在相应的位置画上数字1~12代表12个小时。

Public Sub Draw(ByVal g As Graphics)

DrawClockFace(g)

DrawImage(g)

DrawNumbers(g)

DrawPin(g)

End Sub

下面是ClockFace类的属性:

Private ClockRectangle As Rectangle

Private ClockFont As Font = New Font("Arial", 12)

Private midPoint As Point

Private ClockImage As Bitmap

Private Const IMAGEX As Integer = 50

Private Const IMAGEY As Integer = 50

DrawClockFace方法用来画时钟表面:

Private Sub DrawClockFace(ByVal g As Graphics)

g.FillEllipse(Brushes.White, ClockRectangle.Left + 10, ClockRectangle.Top + 10, ClockRectangle.Width - 20, ClockRectangle.Height - 20)

g.DrawEllipse(Pens.Black, ClockRectangle.Left + 10, ClockRectangle.Top + 10, ClockRectangle.Width - 20, ClockRectangle.Height - 20)

End Sub

然后用Graphics对象的DrawImage方法画出米老鼠的图片:

Private Sub DrawImage(ByVal g As Graphics)

Dim nWidth As Integer = ClockImage.Width

Dim nHeight As Integer = ClockImage.Height

Dim destRect As Rectangle = New Rectangle(midPoint.X - IMAGEX / 2, midPoint.Y - IMAGEY / 2, IMAGEX, IMAGEY)

g.DrawImage(ClockImage, destRect)

End Sub

数字在时钟上的位置是用sin和cos函数计算的:

Private Sub DrawNumbers(ByVal g As Graphics)

Dim count As Integer = 1

Dim a As Double

For a = 0 To 2 * Math.PI Step 2 * Math.PI / 12

Dim x As Double = (ClockRectangle.Width - 70) / 2 * Math.Cos(a - Math.PI / 3) + (ClockRectangle.Width - 70) / 2 + 25

Dim y As Double = (ClockRectangle.Width - 70) / 2 * Math.Sin(a - Math.PI / 3) + (ClockRectangle.Width - 70) / 2 + 20

g.DrawString(Convert.ToString(count), ClockFont, Brushes.Black, CType(x, Single), CType(y, Single), New StringFormat())

count += 1

Next

End Sub

最后是窗体文件(Form1.vb):

Public Class Form1

Inherits System.Windows.Forms.Form

Private MyMinuteHand As MinuteHand

Private MyHourHand As HourHand

Private MySecondHand As SecondHand

Private TheClockFace As ClockFace

Private FirstTick As Boolean = False

‘在窗体的OnPaint事件中取得Graphics对象

Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)

If (FirstTick = False) Then Exit Sub

Dim g As Graphics = e.Graphics

TheClockFace.Draw(g)

MyHourHand.Draw(g)

MyMinuteHand.Draw(g)

MySecondHand.Draw(g)

TheClockFace.DrawPin(g)

End Sub

‘计时器事件

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

MySecondHand.Transform(DateTime.Now)

MyHourHand.Transform(DateTime.Now)

MyMinuteHand.Transform(DateTime.Now)

FirstTick = True

Invalidate()


当前文章:关于vb.net仪表盘源码的信息
标题来源:http://cdkjz.cn/article/hipidj.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

业务热线:400-028-6601 / 大客户专线   成都:13518219792   座机:028-86922220