包含vb.net时钟属性的词条( 二 )


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()
vbnet修改文件属性时候间vbnet修改文件属性时间可以使用File类中的SetCreationTime、SetLastWriteTime和SetLastAccessTime方法实现 。
1、修改文件的创建时间:filePath表示要修改的文件路径,newCreationTime表示新的创建时间,可以使用DateTime类型表示 。
2、修改文件的最后修改时间:filePath表示要修改的文件路径,newLastWriteTime表示新的最后修改时间 , 可以使用DateTime类型表示 。
3、修改文件的最后访问时间:filePath表示要修改的文件路径,newLastAccessTime表示新的最后访问时间,可以使用DateTime类型表示 。
用VB.net做一个时间计时器'添加一个label标签名字label1 用来显示时间
'再添加一个timer控件 名字timer1interval属性=1000 用来计时
'窗体添加代码
Dim t As Date '用来记录时间
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As _
System.EventArgs) Handles Timer1.Tick
t = t.AddSeconds(1)
Label1.Text = "登录时间:"t.TimeOfDay.ToString
End Sub
怎样用vb.net作一个指针转动的钟表?(可设置时间日期,有闹铃功能)vb.net时钟属性你需要会用GDI+,也就是那个System.Drawing命名空间下vb.net时钟属性的类.
给你说个思路,设Timer,到时间就用Form.Invalidate()函数重画窗口,在重画窗口vb.net时钟属性的Form_Paint事件下面编写代码得到当前时间,再根据当前时间用GDI+画时钟.
【包含vb.net时钟属性的词条】vb.net时钟属性的介绍就聊到这里吧,感谢你花时间阅读本站内容 , 更多关于、vb.net时钟属性的信息别忘了在本站进行查找喔 。

推荐阅读