先加分,我给你发代码,[email protected]
解决方案 »
- vb中html代码换行的问题
- 编制一个简单DLL
- 关于DATAGRID的行数问题
- 求两个函数的区别
- 为什么我在本机上调试的程序是对的,到了服务器上就错了.(急急急急急急急急急急)_
- 如何用VB读取 VC写的程序中 MFCGRIDCTRL 控件表格中的文本。
- 在VB中修改DBF库的问题
- VB如何获得SQL存储过程中的消息?
- 为什么我的textbox在运行时光标老在文本前跳动?怎么使textbox在运行是的光标不显示出来?
- 请教:vb菜单
- sql语句 的 格式? &和" 还有 '符号怎么样来规范的使用?还有 纪录集怎么使用和怎么把一个数据库的 字段显示出来和编辑他们?
- 把事先做好的几个工程中的窗体(每个工程中只有一个窗体,并且没有改名)导入同一个新工程组成应用程序,为了不破坏原来的窗体,要注意些什么问题?
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomct2.ocx"
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 'Windows Default
Begin MSComCtl2.DTPicker DTPicker1
Height = 285
Left = 1260
TabIndex = 0
Top = 1020
Width = 1185
_ExtentX = 2090
_ExtentY = 503
_Version = 393216
Format = 23658498
CurrentDate = 37221
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = FalseOption Explicit
谢谢!
[email protected]
Option Explicit' Proportional hand lengths.
Private Const m_HourHandLength = 0.5
Private Const m_MinuteHandLength = 0.75
Private Const m_SecondHandLength = 0.9' The center of the clock.
Private m_Cx As Single
Private m_Cy As SinglePrivate Const PI = 3.14159265' Position the constituent Line controls
' to show the current time.
Private Sub PositionHands()
Dim X As Single
Dim Y As Single
Dim theta As Single ' Position the hour hand.
theta = PI / 2 - Hour(Now) * (PI * 2 / 12)
linHourHand.X2 = m_Cx * (1 + m_HourHandLength * Cos(theta))
linHourHand.Y2 = m_Cy * (1 - m_HourHandLength * Sin(theta)) ' Position the minute hand.
theta = PI / 2 - Minute(Now) * (PI * 2 / 60)
linMinuteHand.X2 = m_Cx * (1 + m_MinuteHandLength * Cos(theta))
linMinuteHand.Y2 = m_Cy * (1 - m_MinuteHandLength * Sin(theta)) ' Position the second hand.
theta = PI / 2 - Second(Now) * (PI * 2 / 60)
linSecondHand.X2 = m_Cx * (1 + m_SecondHandLength * Cos(theta))
linSecondHand.Y2 = m_Cy * (1 - m_SecondHandLength * Sin(theta))
End SubPrivate Sub tmrTick_Timer()
Static last_time As Date If last_time = Now Then Exit Sub last_time = Now
PositionHands
End Sub
Private Sub UserControl_Initialize()
Dim i As Integer ' Load tic Line controls.
For i = 1 To 59
Load linTic(i)
linTic(i).Visible = True
Next i
End Sub' Position the clock face and tic s. Put one end
' of the hands at the center of the clock.
Private Sub UserControl_Resize()
Const TIC_R1 = 0.95
Const TIC_R2 = 0.9
Dim i As Integer
Dim tic_r As Single
Dim theta As Single
Dim dtheta As Single
Dim cos_theta As Single
Dim sin_theta As Single ' Make the clock face fit the control.
shpClockFace.Move 0, 0, ScaleWidth, ScaleHeight ' Find the center of the clock.
m_Cx = ScaleWidth / 2
m_Cy = ScaleHeight / 2 ' Move one end of the hands to the center.
linHourHand.X1 = m_Cx
linHourHand.Y1 = m_Cy
linMinuteHand.X1 = m_Cx
linMinuteHand.Y1 = m_Cy
linSecondHand.X1 = m_Cx
linSecondHand.Y1 = m_Cy ' Position the tic s.
theta = PI / 2
dtheta = 2 * PI / 60
For i = 0 To 59
' Make every 5th tic longer.
If i Mod 5 = 0 Then
tic_r = TIC_R2
Else
tic_r = TIC_R1
End If ' Position the tic .
With linTic(i)
.X1 = m_Cx * (1 + Cos(theta))
.Y1 = m_Cx * (1 + Sin(theta))
.X2 = m_Cx * (1 + tic_r * Cos(theta))
.Y2 = m_Cx * (1 + tic_r * Sin(theta))
End With
theta = theta + dtheta
Next i ' Show the time.
PositionHands
End Sub