WNCalendar.ctl

 VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.UserControl WNCalendar
   ClientHeight    =   2655
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   2895
   PropertyPages   =   "WNCalendar.ctx":0000
   ScaleHeight     =   2655
   ScaleWidth      =   2895
   Begin MSComCtl2.FlatScrollBar scrYear
      Height          =   315
      Left            =   2520
      TabIndex        =   53
      Top             =   120
      Width           =   225
      _ExtentX        =   397
      _ExtentY        =   556
      _Version        =   393216
      Min             =   -32767
      Orientation     =   1179648
   End
   Begin VB.TextBox txtYear
      Height          =   315
      Left            =   1560
      Locked          =   -1  'True
      TabIndex        =   2
      Top             =   105
      Width           =   930
   End
   Begin VB.ComboBox cmbMonth
      Height          =   315
      Left            =   120
      Style           =   2  'Dropdown List
      TabIndex        =   1
      Top             =   105
      Width           =   1335
   End
   Begin VB.PictureBox picMonth
      BackColor       =   &H80000005&
      Height          =   2025
      Left            =   120
      ScaleHeight     =   1965
      ScaleWidth      =   2565
      TabIndex        =   0
      Top             =   480
      Width           =   2625
      Begin VB.Label lblDay
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Height          =   255
         Index           =   41
         Left            =   2160
         TabIndex        =   52
         Top             =   1680
         Width           =   375
      End
      Begin VB.Label lblDay
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Height          =   255
         Index           =   40
         Left            =   1800
         TabIndex        =   51
         Top             =   1680
         Width           =   375
      End
      Begin VB.Label lblDay
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Height          =   255
         Index           =   39
         Left            =   1440
         TabIndex        =   50
         Top             =   1680
         Width           =   375
      End
      Begin VB.Label lblDay
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Height          =   255
         Index           =   38
         Left            =   1080
         TabIndex        =   49
         Top             =   1680
         Width           =   375
      End
      Begin VB.Label lblDay
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Height          =   255
         Index           =   37
         Left            =   720
         TabIndex        =   48
         Top             =   1680
         Width           =   375
      End
      Begin VB.Label lblDay
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Height          =   255
         Index           =   36
         Left            =   360
         TabIndex        =   47
         Top             =   1680
         Width           =   375
      End
      Begin VB.Label lblDay
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Height          =   255
         Index           =   35
         Left            =   0
         TabIndex        =   46
         Top             =   1680
         Width           =   375
      End
      Begin VB.Label lblDay
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Height          =   255
         Index           =   34
         Left            =   2160
         TabIndex        =   45
         Top             =   1395
         Width           =   375
      End
      Begin VB.Label lblDay
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Height          =   255
         Index           =   33
         Left            =   1800
         TabIndex        =   44
         Top             =   1395
         Width           =   375
      End
      Begin VB.Label lblDay
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Height          =   255
         Index           =   32
         Left            =   1440
         TabIndex        =   43
         Top             =   1395
         Width           =   375
      End
      Begin VB.Label lblDay
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Height          =   255
         Index           =   31
         Left            =   1080
         TabIndex        =   42
         Top             =   1395
         Width           =   375
      End
      Begin VB.Label lblDay
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Height          =   255
         Index           =   30
         Left            =   720
         TabIndex        =   41
         Top             =   1395
         Width           =   375
      End
      Begin VB.Label lblDay
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Height          =   255
         Index           =   29
         Left            =   360
         TabIndex        =   40
         Top             =   1395
         Width           =   375
      End
      Begin VB.Label lblDay
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Height          =   255
         Index           =   28
         Left            =   0
         TabIndex        =   39
         Top             =   1395
         Width           =   375
      End
      Begin VB.Label lblDay
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Height          =   255
         Index           =   27
         Left            =   2160
         TabIndex        =   38
         Top             =   1110
         Width           =   375
      End
      Begin VB.Label lblDay
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Height          =   255
         Index           =   26
         Left            =   1800
         TabIndex        =   37
         Top             =   1110
         Width           =   375
      End
      Begin VB.Label lblDay
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Height          =   255
         Index           =   25
         Left            =   1440
         TabIndex        =   36
         Top             =   1110
         Width           =   375
      End
      Begin VB.Label lblDay
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Height          =   255
         Index           =   24
         Left            =   1080
         TabIndex        =   35
         Top             =   1110
         Width           =   375
      End
      Begin VB.Label lblDay
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Height          =   255
         Index           =   23
         Left            =   720
         TabIndex        =   34
         Top             =   1110
         Width           =   375
      End
      Begin VB.Label lblDay
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Height          =   255
         Index           =   22
         Left            =   360
         TabIndex        =   33
         Top             =   1110
         Width           =   375
      End
      Begin VB.Label lblDay
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Height          =   255
         Index           =   21
         Left            =   0
         TabIndex        =   32
         Top             =   1110
         Width           =   375
      End
      Begin VB.Label lblDay
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Height          =   255
         Index           =   20
         Left            =   2160
         TabIndex        =   31
         Top             =   825
         Width           =   375
      End
      Begin VB.Label lblDay
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Height          =   255
         Index           =   19
         Left            =   1800
         TabIndex        =   30
         Top             =   825
         Width           =   375
      End
      Begin VB.Label lblDay
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Height          =   255
         Index           =   18
         Left            =   1440
         TabIndex        =   29
         Top             =   825
         Width           =   375
      End
      Begin VB.Label lblDay
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Height          =   255
         Index           =   17
         Left            =   1080
         TabIndex        =   28
         Top             =   825
         Width           =   375
      End
      Begin VB.Label lblDay
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Height          =   255
         Index           =   16
         Left            =   720
         TabIndex        =   27
         Top             =   825
         Width           =   375
      End
      Begin VB.Label lblDay
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Height          =   255
         Index           =   15
         Left            =   360
         TabIndex        =   26
         Top             =   825
         Width           =   375
      End
      Begin VB.Label lblDay
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Height          =   255
         Index           =   14
         Left            =   0
         TabIndex        =   25
         Top             =   825
         Width           =   375
      End
      Begin VB.Label lblDay
         Alignment       =   2  'Center
         Appearance      =   0  'Flat
         BackStyle       =   0  'Transparent
         ForeColor       =   &H80000008&
         Height          =   255
         Index           =   13
         Left            =   2160
         TabIndex        =   24
         Top             =   540
         Width           =   375
      End
      Begin VB.Label lblDay
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Height          =   255
         Index           =   12
         Left            =   1800
         TabIndex        =   23
         Top             =   540
         Width           =   375
      End
      Begin VB.Label lblDay
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Height          =   255
         Index           =   11
         Left            =   1440
         TabIndex        =   22
         Top             =   540
         Width           =   375
      End
      Begin VB.Label lblDay
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Height          =   255
         Index           =   10
         Left            =   1080
         TabIndex        =   21
         Top             =   540
         Width           =   375
      End
      Begin VB.Label lblDay
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Height          =   255
         Index           =   9
         Left            =   720
         TabIndex        =   20
         Top             =   540
         Width           =   375
      End
      Begin VB.Label lblDay
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Height          =   255
         Index           =   8
         Left            =   360
         TabIndex        =   19
         Top             =   540
         Width           =   375
      End
      Begin VB.Label lblDay
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Height          =   255
         Index           =   7
         Left            =   0
         TabIndex        =   18
         Top             =   540
         Width           =   375
      End
      Begin VB.Label lblDay
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Height          =   255
         Index           =   6
         Left            =   2160
         TabIndex        =   17
         Top             =   255
         Width           =   375
      End
      Begin VB.Label lblDay
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Height          =   255
         Index           =   5
         Left            =   1800
         TabIndex        =   16
         Top             =   255
         Width           =   375
      End
      Begin VB.Label lblDay
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Height          =   255
         Index           =   4
         Left            =   1440
         TabIndex        =   15
         Top             =   255
         Width           =   375
      End
      Begin VB.Label lblDay
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Height          =   255
         Index           =   3
         Left            =   1080
         TabIndex        =   14
         Top             =   255
         Width           =   375
      End
      Begin VB.Label lblDay
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Height          =   255
         Index           =   2
         Left            =   720
         TabIndex        =   13
         Top             =   255
         Width           =   375
      End
      Begin VB.Label lblDay
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Height          =   255
         Index           =   1
         Left            =   360
         TabIndex        =   12
         Top             =   255
         Width           =   375
      End
      Begin VB.Label lblDay
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Height          =   255
         Index           =   0
         Left            =   0
         TabIndex        =   11
         Top             =   255
         Width           =   375
      End
      Begin VB.Label lblDayHeader
         Alignment       =   2  'Center
         Appearance      =   0  'Flat
         BackColor       =   &H80000005&
         BackStyle       =   0  'Transparent
         ForeColor       =   &H80000008&
         Height          =   255
         Index           =   6
         Left            =   2160
         TabIndex        =   10
         Top             =   0
         Width           =   375
      End
      Begin VB.Label lblDayHeader
         Alignment       =   2  'Center
         Appearance      =   0  'Flat
         BackColor       =   &H80000005&
         BackStyle       =   0  'Transparent
         ForeColor       =   &H80000008&
         Height          =   255
         Index           =   5
         Left            =   1800
         TabIndex        =   9
         Top             =   0
         Width           =   375
      End
      Begin VB.Label lblDayHeader
         Alignment       =   2  'Center
         Appearance      =   0  'Flat
         BackColor       =   &H80000005&
         BackStyle       =   0  'Transparent
         ForeColor       =   &H80000008&
         Height          =   255
         Index           =   4
         Left            =   1440
         TabIndex        =   8
         Top             =   0
         Width           =   375
      End
      Begin VB.Label lblDayHeader
         Alignment       =   2  'Center
         Appearance      =   0  'Flat
         BackColor       =   &H80000005&
         BackStyle       =   0  'Transparent
         ForeColor       =   &H80000008&
         Height          =   255
         Index           =   3
         Left            =   1080
         TabIndex        =   7
         Top             =   0
         Width           =   375
      End
      Begin VB.Label lblDayHeader
         Alignment       =   2  'Center
         Appearance      =   0  'Flat
         BackColor       =   &H80000005&
         BackStyle       =   0  'Transparent
         ForeColor       =   &H80000008&
         Height          =   255
         Index           =   2
         Left            =   720
         TabIndex        =   6
         Top             =   0
         Width           =   375
      End
      Begin VB.Label lblDayHeader
         Alignment       =   2  'Center
         Appearance      =   0  'Flat
         BackColor       =   &H80000005&
         BackStyle       =   0  'Transparent
         ForeColor       =   &H80000008&
         Height          =   255
         Index           =   1
         Left            =   360
         TabIndex        =   5
         Top             =   0
         Width           =   375
      End
      Begin VB.Label lblDayHeader
         Alignment       =   2  'Center
         Appearance      =   0  'Flat
         BackColor       =   &H80000005&
         BackStyle       =   0  'Transparent
         ForeColor       =   &H80000008&
         Height          =   255
         Index           =   0
         Left            =   0
         TabIndex        =   4
         Top             =   0
         Width           =   375
      End
      Begin VB.Label lblDayBG
         BackColor       =   &H00C0C0C0&
         Height          =   255
         Left            =   0
         TabIndex        =   3
         Top             =   0
         Width           =   2775
      End
   End
End
Attribute VB_Name = "WNCalendar"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
' WNCalendar v1.0
' Written By: Jeffrey Winn, USA
'
' I've found that there are many different calendar controls out there however, they are all
' useless for the most part. I didn't like the interface, or they just didn't have much functionality
' to them. So I created this one instead of using them. Feel free to distribute the control however
' you want. :)

Public Enum ViewTypes
    Flat = 0
    [3D] = 1
End Enum

Public Enum ViewStyles
    Transparent = 0
    Opaque = 1
End Enum

Public Enum Languages
    English = 0
    Spanish = 1
    German = 2
    French = 3
End Enum

Private MyProps As PropertyBag

Private booBypass As Boolean
Private strToday As Date
Private prevYear As Integer

' Public Event Declarations
Public Event Click()
Public Event ChangedMonth()
Public Event ChangedYear()
Public Event ChangedLanguage()
Public Event MouseDown(Button As Integer, Shift As Integer)
Public Event MouseUp(Button As Integer, Shift As Integer)

' Default Values for the Properties
Private Const ctl_def_Language = 0
Private Const ctl_def_Appearance = 1
Private Const ctl_def_TitleColor = &H8000000A
Private Const ctl_def_BackColor = &H8000000F
Private Const ctl_def_MonthBackColor = &H80000005

' Variables for the Properties
Private ctlLanguage As Languages
Private ctlTitleColor As OLE_COLOR
Private ctlAppearance As ViewTypes
Private ctlEnabled As Boolean
Private ctlBackStyle As ViewStyles
Private ctlBackColor As OLE_COLOR
Private ctlMonthBackColor As OLE_COLOR
Private ctlCurrentDate As Date
Private ctl_def_CurrentDate As Date

Private Function UpdateDays(ByVal MonthIn As Integer, ByVal YearIn As String, Optional ByVal TagToday As Boolean = True, Optional ByVal TagDay As Integer) As Boolean
    Dim strFirst As String, intStart As Integer, curDay As Integer
   
    strToday = Date
    strFirst = Format$(MonthIn & "/01/" & YearIn, "dddd")
    Select Case strFirst
    Case "Sunday"
        intStart = 0
    Case "Monday"
        intStart = 1
    Case "Tuesday"
        intStart = 2
    Case "Wednesday"
        intStart = 3
    Case "Thursday"
        intStart = 4
    Case "Friday"
        intStart = 5
    Case "Saturday"
        intStart = 6
    End Select
   
    ' Reset the labels prior to the first day
    For X = 0 To intStart
        lblDay.Item(X).Caption = ""
    Next X
   
    ' Display the days
    curDay = 1
    For X = intStart To lblDay.Count - 1
        If IsDate(MonthIn & "/" & curDay & "/" & YearIn) = True Then
            lblDay.Item(X).Caption = curDay
            If (Format$(MonthIn & "/" & Str(curDay) & "/" & YearIn, "mm/dd/yyyy") = strToday) And TagToday = True Then
                lblDay.Item(X).BackStyle = 1
            ElseIf (TagToday = False) And curDay = TagDay Then
                lblDay.Item(X).BackStyle = 1
            Else
                lblDay.Item(X).BackStyle = 0
            End If
            curDay = curDay + 1
        Else
            lblDay.Item(X).Caption = ""
        End If
    Next X
   
End Function

Private Function UpdateCalendar(ByVal NewDate As Date) As Boolean
    booBypass = True
   
    txtYear.Text = Year(NewDate)
    Call UpdateMonths(, CStr(NewDate))
   
    booBypass = False
End Function

Private Function UpdateMonths(Optional ByVal InLanguage As Languages = 0, Optional ByVal NewDate As String = "") As Boolean
    Select Case InLanguage
    Case 0
        With cmbMonth
            .Clear
            .AddItem "January"
            .AddItem "February"
            .AddItem "March"
            .AddItem "April"
            .AddItem "May"
            .AddItem "June"
            .AddItem "July"
            .AddItem "August"
            .AddItem "September"
            .AddItem "October"
            .AddItem "November"
            .AddItem "December"
        End With
       
        With lblDayHeader
            .Item(0).Caption = "S"
            .Item(1).Caption = "M"
            .Item(2).Caption = "T"
            .Item(3).Caption = "W"
            .Item(4).Caption = "T"
            .Item(5).Caption = "F"
            .Item(6).Caption = "S"
        End With
    Case 1
        With cmbMonth
            .Clear
            .AddItem "Enero"
            .AddItem "Febrero"
            .AddItem "Marzo"
            .AddItem "Abril"
            .AddItem "Mayo"
            .AddItem "Junio"
            .AddItem "Julio"
            .AddItem "Augusto"
            .AddItem "Septiembre"
            .AddItem "Octubre"
            .AddItem "Noviembre"
            .AddItem "Diciembre"
        End With
       
        With lblDayHeader
            .Item(0).Caption = "D"
            .Item(1).Caption = "L"
            .Item(2).Caption = "M"
            .Item(3).Caption = "M"
            .Item(4).Caption = "J"
            .Item(5).Caption = "V"
            .Item(6).Caption = "S"
        End With
    Case 2
        With cmbMonth
            .Clear
            .AddItem "Januar"
            .AddItem "Februar"
            .AddItem "März"
            .AddItem "April"
            .AddItem "Mai"
            .AddItem "Juni"
            .AddItem "Juli"
            .AddItem "August"
            .AddItem "September"
            .AddItem "Oktober"
            .AddItem "November"
            .AddItem "Dezember"
        End With
       
        With lblDayHeader
            .Item(0).Caption = "S"
            .Item(1).Caption = "M"
            .Item(2).Caption = "D"
            .Item(3).Caption = "M"
            .Item(4).Caption = "D"
            .Item(5).Caption = "F"
            .Item(6).Caption = "S"
        End With
    Case 3
        With cmbMonth
            .Clear
            .AddItem "Janvier"
            .AddItem "Février"
            .AddItem "Mars"
            .AddItem "Avril"
            .AddItem "Mai"
            .AddItem "Juin"
            .AddItem "Juillet"
            .AddItem "Août"
            .AddItem "Septembre"
            .AddItem "Octobre"
            .AddItem "Novembre"
            .AddItem "Décembre"
        End With
       
        With lblDayHeader
            .Item(0).Caption = "D"
            .Item(1).Caption = "L"
            .Item(2).Caption = "M"
            .Item(3).Caption = "M"
            .Item(4).Caption = "J"
            .Item(5).Caption = "V"
            .Item(6).Caption = "S"
        End With
    Case Else
    End Select
   
    If NewDate = "" Then
        cmbMonth.Text = cmbMonth.List((Month(Date) - 1))
    Else    ' New Date coming in, update the days
        cmbMonth.Text = cmbMonth.List((Month(CDate(NewDate)) - 1))
        Call UpdateDays(Month(NewDate), Year(NewDate), False, Day(NewDate))
    End If
End Function

Public Property Get MonthBackColor() As OLE_COLOR
    MonthBackColor = ctlMonthBackColor
   
End Property

Public Property Let MonthBackColor(InValue As OLE_COLOR)
    ctlMonthBackColor = InValue
    picMonth.BackColor = InValue
    PropertyChanged "MonthBackColor"
   
End Property

Public Property Get Enabled() As Boolean
    Enabled = ctlEnabled
   
End Property

Public Property Let Enabled(InValue As Boolean)
    ctlEnabled = InValue
    UserControl.Enabled = InValue
    PropertyChanged "Enabled"
   
End Property

Public Property Get Appearance() As ViewTypes
    Appearance = ctlAppearance
   
End Property

Public Property Let Appearance(NewView As ViewTypes)
    ctlAppearance = NewView
    PropertyChanged "Appearance"
   
    Select Case ctlAppearance
    Case 0      ' Flat
        picMonth.Appearance = 0
        txtYear.Appearance = 0
        UserControl.Appearance = 0
        UserControl.BackColor = Me.BackColor
    Case 1      ' 3D
        picMonth.Appearance = 1
        txtYear.Appearance = 1
        UserControl.Appearance = 1
        UserControl.BackColor = Me.BackColor
    End Select
   
End Property

Public Property Get BackStyle() As ViewStyles
    BackStyle = ctlBackStyle
   
End Property

Public Property Let BackStyle(NewStyle As ViewStyles)
    ctlBackStyle = NewStyle
    UserControl.BackStyle = NewStyle
    PropertyChanged "BackStyle"
   
End Property

Public Property Get BackColor() As OLE_COLOR
    BackColor = ctlBackColor
   
End Property

Public Property Let BackColor(InValue As OLE_COLOR)
    ctlBackColor = InValue
    UserControl.BackColor = InValue
    PropertyChanged "BackColor"
   
End Property

Public Property Get Language() As Languages
    Language = ctlLanguage
   
End Property

Public Property Let Language(NewLanguage As Languages)
    ctlLanguage = NewLanguage
    retval = UpdateMonths(NewLanguage)
    PropertyChanged "Language"
   
    RaiseEvent ChangedLanguage
End Property

Public Property Get CurrentDate() As Date
    CurrentDate = ctlCurrentDate
   
End Property

Public Property Let CurrentDate(InValue As Date)
    ctlCurrentDate = InValue
    PropertyChanged "CurrentDate"
   
    UpdateCalendar InValue
End Property

Public Property Get TitleColor() As OLE_COLOR
    TitleColor = ctlTitleColor
       
End Property

Public Property Let TitleColor(ByVal InColor As OLE_COLOR)
    ctlTitleColor = InColor
    lblDayBG.BackColor = ctlTitleColor
    PropertyChanged "TitleColor"
   
End Property

Private Sub cmbMonth_Click()
    If booBypass = True Then Exit Sub
   
    retval = UpdateDays((cmbMonth.ListIndex + 1), txtYear.Text)
    RaiseEvent ChangedMonth
   
End Sub

Private Sub lblDay_Click(Index As Integer)
    If lblDay.Item(Index).Caption <> "" Then
        For X = 0 To lblDay.Count - 1
            lblDay.Item(X).BackStyle = 0
        Next X
       
        lblDay.Item(Index).BackStyle = 1
        ctlCurrentDate = Format$(cmbMonth.Text & "/" & lblDay.Item(Index).Caption & "/" & txtYear.Text, "mm/dd/yyyy", vbUseSystemDayOfWeek, vbUseSystem)
        RaiseEvent Click
    End If
   
End Sub

Private Sub picMonth_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    RaiseEvent MouseDown(Button, Shift)
   
End Sub

Private Sub picMonth_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    RaiseEvent MouseUp(Button, Shift)
   
End Sub

Private Sub scrYear_Change()
    If scrYear.Value < prevYear Then
        txtYear.Text = Val(txtYear.Text) + 1
        prevYear = scrYear.Value
    Else
        txtYear.Text = Val(txtYear.Text) - 1
        prevYear = scrYear.Value
    End If
   
    retval = UpdateDays(Val(Format(cmbMonth.Text & "/01/2000", "m")), txtYear.Text)
   
    RaiseEvent ChangedYear
End Sub

Private Sub UserControl_Initialize()
    strToday = Format$(Date, "mm/dd/yyyy")
    ctl_def_CurrentDate = strToday
End Sub

Private Sub UserControl_InitProperties()
    ctlEnabled = True
    ctlLanguage = ctl_def_Language
    ctlBackStyle = 1
    ctlBackColor = ctl_def_BackColor
    ctlTitleColor = ctl_def_TitleColor
    ctlAppearance = ctl_def_Appearance
    ctlMonthBackColor = ctl_def_MonthBackColor
    ctlCurrentDate = ctl_def_CurrentDate
   
End Sub

Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
    ctlLanguage = PropBag.ReadProperty("Language", ctl_def_Language)
    ctlAppearance = PropBag.ReadProperty("Appearance", ctl_def_Appearance)
    ctlEnabled = PropBag.ReadProperty("Enabled", True)
    ctlBackStyle = PropBag.ReadProperty("BackStyle", 1)
    ctlBackColor = PropBag.ReadProperty("BackColor", ctl_def_BackColor)
    ctlTitleColor = PropBag.ReadProperty("TitleColor", ctl_def_TitleColor)
    ctlMonthBackColor = PropBag.ReadProperty("MonthBackColor", ctl_def_MonthBackColor)
    ctlCurrentDate = PropBag.ReadProperty("CurrentDate", ctl_def_CurrentDate)
End Sub

Private Sub UserControl_Show()
    txtYear.Text = Format$(Date, "yyyy", vbUseSystemDayOfWeek, vbUseSystem)
    retval = UpdateMonths(ctlLanguage)
    prevYear = 0
       
    UserControl.Width = 2895
    UserControl.Height = 2655
    lblDayBG.BackColor = ctlTitleColor
    UserControl.Enabled = ctlEnabled
    UserControl.BackStyle = ctlBackStyle
    UserControl.BackColor = ctlBackColor
End Sub

Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
    With PropBag
        Call .WriteProperty("Language", ctlLanguage, ctl_def_Language)
        Call .WriteProperty("Appearance", ctlAppearance, ctl_def_Appearance)
        Call .WriteProperty("Enabled", ctlEnabled, True)
        Call .WriteProperty("BackStyle", ctlBackStyle, 1)
        Call .WriteProperty("BackColor", ctlBackColor, ctl_def_BackColor)
        Call .WriteProperty("TitleColor", ctlTitleColor, ctl_def_TitleColor)
        Call .WriteProperty("MonthBackColor", ctlMonthBackColor, ctl_def_MonthBackColor)
        Call .WriteProperty("CurrentDate", ctlCurrentDate, ctl_def_CurrentDate)
    End With
End Sub

Project Homepage: