home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form fCalendar
- BackColor = &H00C0C0C0&
- BorderStyle = 3 'Fixed Double
- Caption = "FlexCalendar"
- ClientHeight = 3870
- ClientLeft = 1095
- ClientTop = 1485
- ClientWidth = 7245
- Height = 4275
- Icon = 0
- Left = 1035
- LinkTopic = "Form1"
- ScaleHeight = 3870
- ScaleWidth = 7245
- Top = 1140
- Width = 7365
- Begin TextBox txtNotes
- BackColor = &H00FFFFFF&
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- ForeColor = &H00000000&
- Height = 1095
- Left = 5175
- TabIndex = 3
- Text = "Notes:"
- Top = 2520
- Visible = 0 'False
- Width = 2010
- End
- Begin vsFlexArray cal
- BackColor = &H00C0C0C0&
- BackColorSel = &H00000080&
- Cols = 7
- FixedCols = 0
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- ForeColor = &H00000000&
- GridLines = 2 'Inset
- Height = 2880
- Left = 240
- RowHeightMin = 405
- Rows = 7
- ScrollBars = 0 'None
- TabIndex = 1
- Top = 780
- Width = 6765
- End
- Begin Label Label2
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "Drag and Drop -->"
- FontBold = 0 'False
- FontItalic = 0 'False
- FontName = "MS Sans Serif"
- FontSize = 8.25
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- ForeColor = &H00800080&
- Height = 195
- Left = 3930
- TabIndex = 2
- Top = 360
- Width = 1275
- End
- Begin Image Image1
- Height = 330
- Index = 3
- Left = 6060
- Picture = FCAL.FRX:0000
- Top = 315
- Width = 360
- End
- Begin Image Image1
- Height = 330
- Index = 2
- Left = 5655
- Picture = FCAL.FRX:0182
- Top = 315
- Width = 360
- End
- Begin Image Image1
- Height = 330
- Index = 1
- Left = 5250
- Picture = FCAL.FRX:0304
- Top = 315
- Width = 360
- End
- Begin Image Image1
- Height = 330
- Index = 0
- Left = 4755
- Top = 330
- Visible = 0 'False
- Width = 390
- End
- Begin Label Label1
- Alignment = 2 'Center
- BackColor = &H00000000&
- Caption = "Label1"
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "Arial"
- FontSize = 18
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- ForeColor = &H0000FFFF&
- Height = 465
- Left = 240
- TabIndex = 0
- Top = 270
- Width = 3420
- End
- Option Explicit
- Dim TempDate#
- Sub cal_DblClick ()
- ' avoid first row or blank days
- If cal.MouseRow = 0 Or cal = "" Then Exit Sub
- txtNotes.Move (cal.CellLeft + cal.Left) + 100, (cal.CellTop + cal.Top) + 100
- txtNotes.Visible = True
- txtNotes.SetFocus
- End Sub
- Sub cal_DragDrop (Source As Control, X As Single, Y As Single)
- ' avoid first row and blank days
- If cal.MouseRow = 0 Or cal = "" Then Exit Sub
- ' drop picture to cell
- cal.Row = cal.MouseRow
- cal.Col = cal.MouseCol
- cal.CellPicture = Source
- cal.CellPictureAlignment = 1
- cal.CellBackColor = &H80FFFF
- End Sub
- Sub DoCalendar (AnyDate)
- Dim FirstOfMonth#, FirstOfNextMonth#, DateOffset#, NumDays#
- Dim i%, j%, k%, FiveWeeks%, NumOf%
- ' Basic Date Math to calculate view --------------------------
- TempDate = AnyDate ' save date for future reference
- FirstOfMonth = DateSerial(Year(AnyDate), Month(AnyDate), 1)
- FirstOfNextMonth = DateSerial(Year(AnyDate), Month(AnyDate) + 1, 1)
- NumDays = FirstOfNextMonth - FirstOfMonth
- DateOffset = Weekday(FirstOfMonth) - 1
- ' ------------------------------------------------------------
- cal.Clear 'Clear off the grid
- cal.Row = 0
- cal.FormatString = "^SUN|^MON|^TUE|^WED|^THU|^FRI|^SAT"
- cal.Row = 1
- ' place datenumbers into the cells
- k = DateOffset - 1
- For i = 1 To NumDays
- k = k + 1
- If k = 7 Then
- k = 0
- cal.Row = cal.Row + 1
- End If
-
- ' check to see if the month uses 5 or 6 weeks to display
- FiveWeeks = True
- If cal.Row = 6 Then FiveWeeks = False
-
- cal.Col = k
- cal = Str$(i)
- cal.CellAlignment = 6
- cal.CellPictureAlignment = 4
- Next
- label1 = Format$(FirstOfMonth, "MMMM YYYY")
- ' resize the grid cells to fit form
- For i = 0 To 6
- cal.ColWidth(i) = (cal.Width / 7)
- NumOf% = 5
- If FiveWeeks = True Then NumOf = 6
- For j = 1 To 6
- cal.RowHeight(j) = (cal.Height / NumOf) - ((cal.RowHeight(0) / NumOf))
- Next
- Next
- cal.TopRow = 0
- End Sub
- Sub Form_Load ()
- DoCalendar Now
- End Sub
- Sub Image1_MouseDown (Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
- txtNotes.Visible = False
- Image1(Index).Drag 1
- End Sub
- Sub txtNotes_LostFocus ()
- txtNotes.Visible = False
- End Sub
-