|
Date TimePicker, Month Calendar, Splitter
Date TimePicker
Date TimePicker allows us to select date and time. Date TimePicker is based on the
control class. When we click on the drop-down arrow on this control it displays a
month calendar from which we can make selections. When we make a selection that selection
appears in the textbox part of the Date TimePicker. The image below displays the
Date TimePicker.
Notable Properties of Date TimePicker
The Format property in the Appearance section is used to
select the format of the date and time selected. Default value is long which displays
the date in long format. Other values include short, time and custom
Behavior Section
The CustomFormat property allows us to set the format for
date and time depending on what we like. To use the CustomFormat property we need
to set the Format property to Custom.
The MaxDate Property allows us to set the maximum date we
want the Date TimePicker to hold. Default MaxDate value set by the software is 12/31/9998
.
The MinDate Property allows us to set the minimum date we
want the Date TimePicker to hold. Default MinDate value set by the software is 1/1/1753
.
MonthCalendar
The MonthCalendar control allows us to select date. The difference between a
Date TimePicker and MonthCalendar is, in MonthCalendar we select the date visually
and in Date TimePicker when we want to make a selection we click on the drop-down
arrow and select the date from the MonthCalendar which is displayed. The image below
displays a MonthCalendar control.
Notable Behavior properties of MonthCalendar
FirstDayOfWeek: Default value is Default which means that
the week starts with Sunday as the first day and Saturday as last. You can set the
first day of the week depending upon your choice by selecting from the predefined
list with this property.
ShowToday: Default value is set to True which displays the
current date at the bottom of the Calendar. Setting it to False will hide it.
ShowTodayCircle: Default value is set to True which displays
a red circle on the current date. Setting it to False will make the circle disappear.
ShowWeekNumber: Default is False. Setting it to True will
display the week number of the current week in the 52 week year. That will be displayed
towards the left side of the control.
Splitter
The Splitter control is used to resize other controls. The main purpose of Splitter
control is to save space on the form. Once when we finish working with a particular
control we can move it away from it's position or resize them with Splitter control.
The Splitter control is invisible when we run the application but when the mouse
is over it, the mouse cursor changes indicating that it's a Splitter control and it
can be resized. This control can be very useful when we are working with controls
both at design time and run time (which are not visible at design time). The Splitter
control is based on the Control class.
Working with Splitter Control
To work with a Splitter Control we need to make sure that the other control with which
this control works is docked towards the same side of the container. Let's do that
with an example. Assume that we have a TextBox on the form. Drag a Splitter control
onto the form. Set the TextBox's dock property to left. If we want to resize the TextBox
once we finish using it set the Splitter's dock property to left (both the controls
should be docked towards the same end). When the program is executed and when you
pass the mouse over the Splitter control it allows us to resize the TextBox allowing
us to move it away from it's current position.
|