先加分,我给你发代码,[email protected]

解决方案 »

  1.   

    这样你可以用控件:(如果要自己做,请再邮件)VERSION 5.00
    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
      

  2.   

    先谢谢这位高手,我是要时间控件,不是日期的,我一定加分!
    谢谢!
    [email protected]
      

  3.   

    要钟么?这里有一个,存为.ctl控件.但我想你要的是TextBox里的时间随VSCrollBar变化吧只要判断鼠标在时钟/分钟/秒钟上就行了.
    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