65.9K
CodeProject 正在变化。 阅读更多。
Home

OCX 日历 VB

starIconstarIconstarIcon
emptyStarIcon
starIcon
emptyStarIcon

3.29/5 (7投票s)

2002 年 4 月 26 日

CPOL
viewsIcon

398619

downloadIcon

6094

Visual Basic 的 OCX 用户控件

Sample Image - OCX_Calendar.jpg

引言

这是一个用于 Visual Basic 的 OCX 日历用户控件。

调用日历控件的方法

Calendario.Generate (Date)

DATE 参数是默认选定的日期。
获取选定的日期

MsgBox Calendario.DateOutput

代码非常简单。

显示月份中的某一天

For intI = 1 To intCantSemanas
    For IntJ = 1 To 7
        intCantAct = intCantAct + 1
        
        If intCantAct >= intDiaSemana Then
            intDay = intDay + 1
            
            If IsDate(intDay & "/" & strMonth & "/" & strYear) Then
                strFechaOut = intDay & "/" & strMonth & "/" & strYear
                lblDay(intCantAct) = intDay
                lblDay(intCantAct).ForeColor = &H80000008
                lblDay(intCantAct).ToolTipText = Format(strFechaOut, "dd/mm/yyyy")
            Else
                intCantDes = intCantDes + 1
                strFechaOut = intCantDes & "/" & _
			Month(DateAdd("m", 1, strFechaOut)) & "/" & strYear
                lblDay(intCantAct) = intCantDes
                lblDay(intCantAct).ForeColor = &HC0C0C0
                lblDay(intCantAct).ToolTipText = Format(strFechaOut, "dd/mm/yyyy")
            End If
        Else
            strFechaOut = DateAdd("d", intCantAct - intDiaSemana, strDate)
            lblDay(intCantAct) = Day(DateAdd("d", intCantAct - intDiaSemana, strDate))
            lblDay(intCantAct).ForeColor = &HC0C0C0
            lblDay(intCantAct).ToolTipText = Format(strFechaOut, "dd/mm/yyyy")
        End If
        
        If lblDay(intCantAct) = strDay Then
            lblDay(intCantAct).BackColor = &H80000008
            lblDay(intCantAct).ForeColor = &HFFFFFF
        End If
    Next IntJ
Next intI

历史

  • 2002 年 4 月 25 日:首次发布
© . All rights reserved.