Click here to Skip to main content
15,882,017 members
Articles / Desktop Programming / Windows Forms
Article

Themed Vista Style navigable Month Calander control with full Keyboard and Designer support

Rate me:
Please Sign up or sign in to vote.
4.90/5 (26 votes)
26 Oct 2009Ms-PL3 min read 45.7K   4.1K   75   12
Month Calander implementation using c#.
Image 1

CalanderControl_demo.PNG

Introduction

Simple to use Month Calendar control supporting

  • Vista Style Navigation
  • Keyboard Support
  • Full Designer Support

Features

Month Calendar control has the following features

  • 6 Pre-defined Themes
  • Supports alpha blend image
  • Full Keyboard support
  • Full Design Time support
  • Supports Saving/Loading of layout colors
  • Supports Disabled back color

Using the Code

Control is simple and straight forward.

Use the designer to fine tune appearance.

designer.PNG

designer2.PNG

Keyboard

  • Enter Key - Select
  • Left Key - Increment Day/Month/Year/Years by one.
  • Right Key - Decrement Day/Month/Year/Years by one.
  • Down Key - Increment Day/month/Year/Years by one column.
  • Up Key - Decrement Day/month/Year/Years by one column.
  • Space bar - Change View form Date to Month, Month to Year, Years to Years.

Points of Interest

MonthCalander

Properties

  • Appearance - MonthCalanderAppearance object containing Appearance of MonthCalendar.
  • BackGroundImageAlpha - % of transparency of BackGroundImage.
  • CaptionFont - Gets or sets Font Family to be used for drawing Caption.
  • CurrentAppearance - MonthCalanderAppearance object containing current appearance.
  • DrawFocused - Gets or sets whether focus rectangle needs to be drawn.
  • HotAppearance - Gets or sets the control supports hover behaviour.
  • NumberFont - Gets or sets Font Family to be used for drawing numbers.
  • SelectedDate - Gets or sets current selected date.

Events

  • ValueChanged - Fired when SelectedDate is changed.
  • ValueChanging - Fired when SelectedDate is about to be changed.

Methods

  • HitTest() - Performs the HitTest
  • bool LoadTheme(string fileName) - Loads the color scheme from a xml file. fileName is location of xml file containing color scheme. Returns wether Load was successfull or not.
  • ResetAppearance() - Reset the appearance of Calander control to default value.
  • bool SaveTheme(string fileName) - Saves current color scheme of the Calander control to a xml file. fileName is path of xml file to which data will be written. Returns wether save was successful or not.

ThemeProperty

Properties

  • UseTheme - Gets or Sets wether to use predefined theme or custom colors.
  • ColorScheme - Gets or Sets ColorScheme to be applied. Please Note : This will not be applicable when UseTheme is set as false.

Events

  • ThemeChanged - Fired when UseTheme or ColorScheme is changed.

Methods

  • bool DefaultChanged() - Returns wether ThemeProperty properties has changed or not.

MonthCalanderAppearance

Properties

  • ActiveTextColor - Gets or Sets color of active text.
  • ArrowColor - Gets or Sets color of navigation arrow.
  • ArrowHoverColor - Gets or Sets hover color of navigation arroe.
  • ButtonBackColor - Gets or Sets back color appearance of navigation buttons.
  • CaptionBackColor - Gets or Sets back appearance of caption background.
  • CaptionTextColor - Gets or Sets color of caption text.
  • ControlBackColor - Gets or Sets backcolor of control.
  • ControlBorderColor - Gets or Sets color of borders.
  • DateDaySaperatorColor - Gets or Sets color of date Day saperator.
  • DayMarker - Gets or Sets color of Date Indicator(e.g. S M T).
  • DisabledMask - Gets or Sets Mask Color when control is disabled.
  • FocusedBorder - Gets or Sets focused border color.
  • HoverColor - Gets or Sets hover color.
  • InactiveTextColor - Gets or Sets inactive text color.
  • Radius - Gets or Sets radius of Arc on hover at edge.
  • SelectedBackColor - Gets or Sets back appearance of selected date.
  • SelectedDateAppearance - Gets or Sets selected date border appearance.
  • TodayBorderColor - Gets or Sets color of today border color.
  • SelectedDateTextColor - Gets or Sets text color of selected date.
  • TodayColor - Gets or Sets color of Today marker.

Events

  • AppearanceChanged - Fired when appearance property is changed.

Methods

  • Assign(MonthCalanderAppearance appearance) - Assigns properties of appearance to current object.
  • bool DefaultChanged() - Returns wether ThemeProperty properties has changed or not.
  • Reset() - Resets current appearance to default appearance.

Known Issues

  • No Test Performed.

History

  • 23 October 2009: Initial draft of the control

License

This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)


Written By
Software Developer (Senior)
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralMy vote of 5 Pin
mocking1315-Aug-12 19:38
mocking1315-Aug-12 19:38 
GeneralImage and text Pin
Edcharsw26-Mar-11 9:12
Edcharsw26-Mar-11 9:12 
GeneralAbility to set month values for use as a 12 month yearbook Pin
BaileyMW3-Nov-09 9:55
BaileyMW3-Nov-09 9:55 
AnswerRe: Ability to set month values for use as a 12 month yearbook Pin
Manish Ranjan Kumar9-Nov-09 2:23
professionalManish Ranjan Kumar9-Nov-09 2:23 
GeneralLocalization Pin
mikeduglas3-Nov-09 5:38
mikeduglas3-Nov-09 5:38 
AnswerRe: Localization Pin
Manish Ranjan Kumar9-Nov-09 2:22
professionalManish Ranjan Kumar9-Nov-09 2:22 
GeneralHi Pin
Ravenet27-Oct-09 15:08
Ravenet27-Oct-09 15:08 
GeneralRe: Hi Pin
Manish Ranjan Kumar27-Oct-09 22:55
professionalManish Ranjan Kumar27-Oct-09 22:55 
GeneralMinor typo Pin
Ravi Bhavnani27-Oct-09 11:08
professionalRavi Bhavnani27-Oct-09 11:08 
GeneralRe: Minor typo Pin
Manish Ranjan Kumar27-Oct-09 22:55
professionalManish Ranjan Kumar27-Oct-09 22:55 
GeneralVery nice. Thx Pin
Mohamed Y. Elamrani27-Oct-09 5:35
Mohamed Y. Elamrani27-Oct-09 5:35 
GeneralRe: Very nice. Thx Pin
Manish Ranjan Kumar27-Oct-09 6:13
professionalManish Ranjan Kumar27-Oct-09 6:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.