这个比较麻烦,我曾经写过这么个程序片段,现在贴上来,代码比较复杂
LineHour,LineMinute,LineSecond分别为时,分,秒针,为Line控件
再画个Timer控件,Interval设置为1000
以上控件位置随便放,代码里调整
Form_Load事件里写
Shape1.Top = 100
Timer事件里写
'利用Label显示数字
If Shape1.Visible True Then Shape1.Visible = True
If LineHour.Visible True Then LineHour.Visible = True
If LineMinute.Visible True Then LineMinute.Visible = True
If LineSecond.Visible True Then LineSecond.Visible = True
Dim cx As Single, cy As Single '圆心坐标
'利用Line控件绘制指针
'利用Line方法绘制刻度
VB.net与VB不同.
VB.net已经有专门绘图的类.
可以定义笔刷然后用Drawing类中的方法绘制.
Private Sub DrawEllipse()
Dim myPen As New System.Drawing.Pen(System.Drawing.Color.Red)
Dim formGraphics as System.Drawing.Graphics
formGraphics = Me.CreateGraphics()
myPen.Dispose()
formGraphics.Dispose()
End Sub
Private Sub DrawRectangle()
你可以通过用VB.net控制excel,让excel生成曲线图,然后利用excelVBA将图输出,最后导入到VB.net就可以了.