Colorize text in calendar

User avatar
sal21
PlatinumLounger
Posts: 4355
Joined: 26 Apr 2010, 17:36

Colorize text in calendar

Post by sal21 »

Code: Select all

Private Sub DrawMonthHeading()

    Dim sText As String
    Dim I As Integer
    Dim iMonth As Integer
    Dim X1 As Integer
    Dim Y1 As Integer

    On Local Error Resume Next

    iMonth = cboMonth.ListIndex + 1

    X1 = picCal.Width / 7
    Y1 = picCal.Height / 7

    picCal.Line (0, 0)-(picCal.Width, Dy), cnLtGrey, BF

    picCal.ForeColor = cnDkGrey

    picCal.Line (X1, Y1)-(X1, picCal.Height)
    picCal.Line (2 * X1, Y1)-(2 * X1, picCal.Height)
    picCal.Line (3 * X1, Y1)-(3 * X1, picCal.Height)
    picCal.Line (4 * X1, Y1)-(4 * X1, picCal.Height)
    picCal.Line (5 * X1, Y1)-(5 * X1, picCal.Height)
    picCal.Line (6 * X1, Y1)-(6 * X1, picCal.Height)

    picCal.Line (0, Y1)-(picCal.Width, Y1)
    picCal.Line (0, 2 * Y1)-(picCal.Width, 2 * Y1)
    picCal.Line (0, 3 * Y1)-(picCal.Width, 3 * Y1)
    picCal.Line (0, 4 * Y1)-(picCal.Width, 4 * Y1)
    picCal.Line (0, 5 * Y1)-(picCal.Width, 5 * Y1)
    picCal.Line (0, 6 * Y1)-(picCal.Width, 6 * Y1)

    picCal.ForeColor = cnBlack

    picCal.FontBold = True

    For I = 1 To 7
        sText = Choose(I, "LUN", "MAR", "MER", "GIO", "VER", "SAB", "DOM")
        picCal.CurrentY = 0.5 * (Dy - picCal.TextHeight(sText))
        picCal.CurrentX = ((I - 1) * dX) + 0.5 * (dX - picCal.TextWidth(sText))
        picCal.Print sText
        
        If sText = "SAB" Or sText = "DOM" Then
        Stop '
        End If
        
    Next

    picCal.FontBold = False

End Sub
this is the code to fill a calendar (in img)

If is the correct routine... in code.

i need to colorize the day SAB and DOM in red and in red also the refered colum in calendar....

Possible?
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78469
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Colorize text in calendar

Post by HansV »

Sorry, no idea.
Best wishes,
Hans