用VB编一个钟表,表针运动程序怎么编?

来源:百度知道 编辑:UC知道 时间:2024/05/22 17:15:36
我用VB编了一个钟表,可表针(不是数字!)1秒1秒在变动,怎么编写这段程序?

这个比较麻烦,我曾经写过这么个程序片段,现在贴上来,代码比较复杂
Shape1是时钟的一个框,是Shape控件,设置 Height 1455 Width 1575
LineHour,LineMinute,LineSecond分别为时,分,秒针,为Line控件
Label3,Label6,Label9,Label12为Label控件,分别为3.6.912点的显示数字
再画个Timer控件,Interval设置为1000
以上控件位置随便放,代码里调整
Form_Load事件里写
Shape1.Top = 100
Shape1.Left = Me.Width - 1800
LineHour.X1 = Shape1.Left + Shape1.Width / 2
LineHour.Y1 = Shape1.Top + Shape1.Height / 2
LineMinute.X1 = Shape1.Left + Shape1.Width / 2
LineMinute.Y1 = Shape1.Top + Shape1.Height / 2
LineSecond.X1 = Shape1.Left + Shape1.Width / 2
LineSecond.Y1 = Shape1.Top + Shape1.Height / 2

Label3.Left = Shape1.Left + Shape1.Width - Label3.Width - 200
Label3.Top = Shape1.Top + (Shape1.Height - Label3.Height) / 2
Label6.Left = Shape1.Left + (Shape1.Width - Label6.Width) / 2
Label6.Top = Shape1.Top + Shape1.Height - Label6.Height + 20
Label9.Left = Shape1.Left + 200
Label9.Top = Shape1.Top + (Shape1.Height - Lab