1.VB6.0å¶ä½çµå表
VB6.0å¶ä½çµå表
è¿æ¯ä¸ä¸ªçµåå¼+æéå¼è¡¨ï¼ä»éè¦ä¸äºæ°å¦ç¥è¯å¦cosï¼sinå½æ°ä½ 代ç æäºé®é¢ï¼æå·²å¸®ä½ ä¿®æ¹ï¼é¡ºä¾¿éä¸ æ³¨é å å¾
Dim alf(0 To ) 'å®ä¹ä¸ªå»åº¦å³æ¹åæ°´å¹³å转è§
Dim pi As Double 'å®ä¹Ï
Private Sub Form_Load()
pi = 3. '设置Ïå¼
End Sub
Private Sub Timer1_Timer()
rr = PicTime.Height / 2 '设置æ¶éçæ转ä¸å¿
ddate = Format(Now,源码css编程源码 "mm:dd:yy") 'è·å¾ç°å¨æ¯ å æå å·å å¹´
ttime = Format(Now, "hh:mm:ss") 'è·å¾ç°å¨æ¯ å æ¶å åå ç§
tMonth = Left(ddate, 2) 'å¾å°æ份
tDay = Mid(ddate, 4, 2) 'å¾å°å¤©æ°
tYear = Right(ddate, 2) 'å¾å°å¹´æ°
hh = Left(ttime, 2) 'å¾å°å°æ¶
ss = Right(ttime, 2) 'å¾å°ç§
mm = Mid(ttime, 4, 2) 'å¾å°æ
TxtYear.Text = "" & tYear 'æ¾ç¤ºç°å¨æ¯.ãå¹´
TxtMth.Text = tMonth 'æ¾ç¤ºæ
TxtDay.Text = tDay 'æ¾ç¤ºå¤©
LblTime.Caption = Time 'å¾å°ç°å¨çæ¶é´
nWidth = PicTime.Width - '设置å»åº¦ç宽度为PicTime宽-
nHourLen = nWidth * 4 / '设置æ¶éé¿åº¦ï¼å¯èªå®ä¹
nMinLen = nWidth * 6 / '设置åéé¿åº¦ï¼å¯èªå®ä¹
nSecLen = nWidth * 8 / '设置ç§éé¿åº¦ï¼å¯èªå®ä¹
alfsec = ((ss - ) / ) * pi 'è·å¾ç§éå³æ¹åæ°´å¹³å转è§
alfmin = ((mm + ss / - ) / ) * pi 'è·å¾åéå³æ¹åæ°´å¹³å转è§
alfhour = ((hh + mm / + ss / - ) / 6) * pi 'è·å¾æ¶ééå³æ¹åæ°´å¹³å转è§
PicTime.Refresh 'å·æ°
'---------------------以ä¸æ¯è®¾ç½®æ¶éå»åº¦---------------------
For I = 0 To ' ç»ä¸ªå»åº¦
alf(I) = I * * pi / 'è·å¾æ¯ä¸å»åº¦å³æ¹åæ°´å¹³å转è§
PicTime.DrawWidth = 1 '设置å»åº¦çº¿å®½ä¸º1åç´
If I = 0 Or I = 3 Or I = 6 Or I = 9 Then 'å½å»åº¦æ¯0,3,6,9ï¼æ¶
PicTime.DrawWidth = 3 '设置å»åº¦çº¿å®½ä¸º3åç´
End If
PicTime.Line (rr + (rr - ) * Cos(alf(I)), rr + (rr - ) * Sin(alf(I)))-(rr + (rr - ) * Cos(alf(I)), rr + (rr - ) * Sin(alf(I))), RGB(, 0, ) '
'è¿å¥è§å¾ï¼
'以 rr + (rr - ) * Cos(alf(I)), rr + (rr - ) * Sin(alf(I)) 为å»åº¦ååæ ï¼ä»¥ rr + (rr - ) * Cos(alf(I)), rr + (rr - ) * Sin(alf(I))
'为æ«åæ ç»ä¸æ¡ ç²è²çº¿
Next I
'-----------------------以ä¸æ¯è®¾ç½®åéçæ转--------------------
PicTime.DrawWidth = 3 '设置æ¶éç线æ¡å®½åº¦ä¸º3åç´
PicTime.Line (rr, rr)-(rr + nHourLen * Cos(alfhour), rr + nHourLen * Sin(alfhour)) 'åä¸
PicTime.DrawWidth = 2 ''设置åéç线æ¡å®½åº¦ä¸º2åç´
PicTime.Line (rr, rr)-(rr + nMinLen * Cos(alfmin), rr + nMinLen * Sin(alfmin)) 'åä¸
PicTime.DrawWidth = 1 ''设置ç§éç线æ¡å®½åº¦ä¸º1åç´
PicTime.Line (rr, rr)-(rr + nSecLen * Cos(alfsec), rr + nSecLen * Sin(alfsec)) 'åä¸
PicTime.DrawWidth = 5 '设置æ¶éä¸å¿ç¹ç大å°ä¸º5åç´
PicTime.PSet (rr, rr), RGB(, 0, ) 'å¨æ¶éä¸å¿ç»ä¸ä¸ä¸ªç²è²ç¹
End Sub