Calendar Control Reference

HTAs

Calendar Control Reference

The following table lists and explains the various parameters available when using the Microsoft Calendar Control. For more information about using the Calendar Control in a script, see the Scripting Week 3 webcast Script It Up a Notch: Adding a Little Pizzazz (and a Lot of Functionality) to Your System Administration Scripts.

Parameter

Data Type

Description

BackColor

Color

Configures the background color of the control. For information on determining color values, see the section of this article titled, well, Determining Color Values.

Day

Integer

Sets the current day of the month.

DayFont

Font

Configures the font used to display the days of the week.

DayFontColor

Color

Configures the color used to display the days of the week. For information on determining color values, see the section of this article titled Determining Color Values.

DayLength

Integer

Sets the format used to display the days of the week: 0 for Short (“M”), 1 for Medium (“Mon”), 2 for Long (“Monday”).

FirstDay

Integer

Sets the day of the week to be displayed in the first column: 0 for Sunday, 1 for Monday, 2 for Tuesday, 3 for Wednesday, 4 for Thursday, 5 for Friday, and 6 for Saturday.

GridCellEffect

Integer

Determines the effect used to display the grid: 0 for Flat, 1 for Raised, 2 for Sunken.

GridFont

Font

Specifies the font used to display the days of the month.

GridFontColor

Color

Specifies the color used to display the days of the month. For information on determining color values, see the section of this article titled Determining Color Values.

GridLinesColor

Color

Determines the color used to display the lines in the grid. To use this parameter GridCellEffect must be set to 0 (Flat). For information on determining color values, see the section of this article titled Determining Color Values.

Month

Integer

Sets the current month. Must be a value between 1 (January) and 12 (December).

MonthLength

Integer

Configures the format used to display the month: 0 for Short (“Jan”), 2 for Long (“January”).

ShowDaySelectors

Boolean

Specifies whether the calendar will display drop-down boxes for the month and year. A value of -1 means True and a value of 0 means False.

ShowDays

Boolean

Specifies whether the calendar display the days of the week. A value of -1 means True and a value of 0 means False.

ShowHorizontalGrid

Boolean

Specifies whether the calendar display horizontal gridlines. A value of -1 means True and a value of 0 means False.

ShowTitle

Boolean

Specifies whether the calendar display the month and year above the calendar grid. A value of -1 means True and a value of 0 means False.

ShowVerticalGridlines

Boolean

Specifies whether to display vertical gridlines. A value of -1 means True and a value of 0 means False.

TitleFont

Font

Sets the font used to display the month and year above the calendar grid.

TitleFontColor

Color

Determines the color used to display the month and year above the calendar grid. For information on determining color values, see the section of this article titled Determining Color Values.

Value

Variant

Sets the currently selected date.

ValueIsNull

Boolean

Specifies whether the value is Null (that is, no data is selected). A value of -1 means True and a value of 0 means False.

Determining Color Values

It’s great that the Calendar control enables you to change the color of everything from the title font to the background color; the only problem, of course, is this: where can you find a list of allowed color values?

Well, to be honest, we don’t think you can: there are so many different colors available to you that we doubt there is a definitive list anywhere. But that’s OK, because you can use Paint and Calculator to determine those color values yourself. Here’s how.

To begin with, start up both Paint and Calculator. In Paint, click Colors and then click Edit Colors. In the Edit Colors dialog box, click Define Custom Colors.

Next, select the color you want to use. When you do so, notice the values that get reported in the boxes labeled Red, Green, and Blue:

Defining Custom Colors

Now do this:

  • Take the value in the Red box (115) and leave it as-is.

  • Using Calculator, take the value in the Green box (210) and multiply it by 256. In our example, that will equal 53760.

  • Take the value in the Blue box (158) and multiply it by 65536. In our example, that will equal 10354688.

  • Add the values together: 115 + 53760 + 10354688 = 10408563.

Once you have the sum of the three values all you have to do is set the desired color parameter to that value:

<param name="BackColor" value="10408563">

The color change will take effect the next time you call up the HTML (or HTA) file hosting the control:

Defining Custom Colors