System windows forms monthcalendar

Month Calendar Конструктор

Определение

Инициализирует новый экземпляр класса MonthCalendar. Initializes a new instance of the MonthCalendar class.

Примеры

В следующем примере кода отображается форма MonthCalendar , содержащая элемент управления, в котором отображается один календарный год. The following code example displays a form containing a MonthCalendar control that displays one calendar year. В примере показано задание BackColor свойств, ForeColor , TitleBackColor , TitleForeColor , CalendarDimensions и TrailingForeColor для настройки вида элемента управления Calendar. The example demonstrates setting the BackColor, ForeColor, TitleBackColor, TitleForeColor, CalendarDimensions, and TrailingForeColor properties to customize the look of the calendar control. Другие свойства, такие как AnnuallyBoldedDates , BoldedDates и, MonthlyBoldedDates задаются для настройки того, какие даты выделены полужирным шрифтом. Other properties such as AnnuallyBoldedDates, BoldedDates, and MonthlyBoldedDates are set to customize which dates are bold. В примере также задаются FirstDayOfWeek MaxDate свойства,, MinDate и MaxSelectionCount для изменения формата календаря. The example also sets the FirstDayOfWeek, MaxDate, MinDate, and MaxSelectionCount properties to change the calendar format. DateSelectedСобытия и DateChanged также обрабатываются, и их состояние отображается в форме. The DateSelected and DateChanged events are also handled and their status is displayed on the form.

Комментарии

MonthCalendarКонструктор создает новый объект MonthCalendar . The MonthCalendar constructor creates a new MonthCalendar.

В следующей таблице представлены исходные значения свойств для экземпляра класса MonthCalendar. The following table shows initial property values for an instance of the MonthCalendar class.

Month Calendar. Annually Bolded Dates Свойство

Определение

Возвращает или задает массив объектов DateTime, который определяет, какие даты ежегодно будут выводиться полужирным шрифтом. Gets or sets the array of DateTime objects that determines which annual days are displayed in bold.

Значение свойства

Массив объектов DateTime. An array of DateTime objects.

Примеры

В следующем примере кода отображается форма MonthCalendar , содержащая элемент управления, в котором отображается один календарный год. The following code example displays a form containing a MonthCalendar control that displays one calendar year. В примере показано задание BackColor свойств, ForeColor , TitleBackColor , TitleForeColor , CalendarDimensions и TrailingForeColor для настройки вида элемента управления Calendar. The example demonstrates setting the BackColor, ForeColor, TitleBackColor, TitleForeColor, CalendarDimensions, and TrailingForeColor properties to customize the look of the calendar control. Другие свойства, такие как AnnuallyBoldedDates , BoldedDates и, MonthlyBoldedDates задаются для настройки того, какие даты выделены полужирным шрифтом. Other properties such as AnnuallyBoldedDates, BoldedDates, and MonthlyBoldedDates are set to customize which dates are bold. В примере также задаются FirstDayOfWeek MaxDate свойства,, MinDate и MaxSelectionCount для изменения формата календаря. The example also sets the FirstDayOfWeek, MaxDate, MinDate, and MaxSelectionCount properties to change the calendar format. DateSelectedСобытия и DateChanged также обрабатываются, и их состояние отображается в форме. The DateSelected and DateChanged events are also handled and their status is displayed on the form.

Читайте также:  Восстановление с помощью командной строки windows не загружался

Комментарии

С помощью этого свойства можно назначить массив дат с ежегодным выделением. Using this property, you can assign an array of annual bold dates. При назначении массива дат существующие даты сначала очищаются. When you assign an array of dates, the existing dates are first cleared.

Month Calendar. Date Changed Event

Definition

Occurs when the date selected in the MonthCalendar changes.

Event Type

Examples

The following code example creates a SelectionRange, sets its Start and End properties, and assigns the SelectionRange to the SelectionRange property of the MonthCalendar control. When the DateChanged event is raised, the Start and End property values are displayed in the text boxes. This example requires that you have a Form with two TextBox controls, a Button, and a MonthCalendar control.

The following code example displays a form containing a MonthCalendar control that displays one calendar year. The example demonstrates setting the BackColor, ForeColor, TitleBackColor, TitleForeColor, CalendarDimensions, and TrailingForeColor properties to customize the look of the calendar control. Other properties such as AnnuallyBoldedDates, BoldedDates, and MonthlyBoldedDates are set to customize which dates are bold. The example also sets the FirstDayOfWeek, MaxDate, MinDate, and MaxSelectionCount properties to change the calendar format. The DateSelected and DateChanged events are also handled and their status is displayed on the form.

Remarks

The DateChanged event occurs during any date selection, whether by mouse, keyboard, or code. The DateSelected event is similar, but it occurs only at the end of a date selection made using the mouse.

For more information about handling events, see Handling and Raising Events.

Элемент управления MonthCalendar (Windows Forms) MonthCalendar Control (Windows Forms)

MonthCalendar Элемент управления Windows Forms представляет собой интуитивно понятный графический интерфейс, позволяющий пользователям просматривать и устанавливать сведения о датах. The Windows Forms MonthCalendar control presents an intuitive graphical interface for users to view and set date information. Элемент управления отображает сетку, содержащую пронумерованные дни месяца, упорядоченные по столбцам в соответствии с днями недели. The control displays a grid containing the numbered days of the month, arranged in columns underneath the days of the week. Вы можете выбрать другой месяц, нажимая кнопки со стрелками с обеих сторон заголовка месяца. You can select a different month by clicking the arrow buttons on either side of the month caption. В отличие от аналогичного DateTimePicker элемента управления, можно выбрать диапазон дат с помощью этого элемента управления, однако DateTimePicker элемент управления позволяет задавать значения времени и даты. Unlike the similar DateTimePicker control, you can select a range of dates with this control; however, the DateTimePicker control allows you to set times as well as dates.

Читайте также:  Lenovo ideapad 330 15igm драйвера windows 10 x64

в этом разделе In This Section

Общие сведения об элементе управления MonthCalendar MonthCalendar Control Overview
Содержит общие понятия MonthCalendar элемента управления, позволяющие пользователям просматривать и задавать сведения о датах для приложения. Introduces the general concepts of the MonthCalendar control, which allows users to view and set date information for an application.

Практическое руководство. Отображение более чем одного месяца в элементе управления MonthCalendar в Windows Forms How to: Display More than One Month in the Windows Forms MonthCalendar Control
Описание настройки MonthCalendar элемента управления для отображения нескольких месяцев одновременно. Describes how to configure the MonthCalendar control to display several months simultaneously.

Практическое руководство. Выбор диапазона дат в элементе управления MonthCalendar в Windows Forms How to: Select a Range of Dates in the Windows Forms MonthCalendar Control
Объясняет, как программным способом выбрать диапазон дат из MonthCalendar элемента управления. Explains how to programmatically select a range of dates from the MonthCalendar control.

Справочник Reference

MonthCalendar
Справочная информация о классе и его членах. Provides reference information on the class and its members.

Элементы управления для использования в формах Windows Forms Controls to Use on Windows Forms
Полный список элементов управления Windows Forms со ссылками на информацию об их применении. Provides a complete list of Windows Forms controls, with links to information on their use.

Элемент управления DateTimePicker DateTimePicker Control
Описывает элемент управления, аналогичный MonthCalendar , хотя DateTimePicker элемент управления также позволяет выбрать время и не позволяет выбрать диапазон дат. Describes a control similar to MonthCalendar, although the DateTimePicker control also allows you to select a time and does not allow you to select a range of dates.

Практическое руководство. Изменение внешнего вида элемента управления MonthCalendar в Windows Forms How to: Change the Windows Forms MonthCalendar Control’s Appearance

MonthCalendarЭлемент управления Windows Forms позволяет настраивать внешний вид календаря различными способами. The Windows Forms MonthCalendar control allows you to customize the calendar’s appearance in many ways. Например, можно задать цветовую схему и выбрать отображение или скрытие номеров недель и текущей даты. For example, you can set the color scheme and choose to display or hide week numbers and the current date.

Изменение цветовой схемы календаря на месяц To change the month calendar’s color scheme

Задайте свойства, такие как TitleBackColor , TitleForeColor и TrailingForeColor . Set properties such as TitleBackColor, TitleForeColor and TrailingForeColor. TitleBackColorСвойство также определяет цвет шрифта для дней недели. The TitleBackColor property also determines the font color for the days of the week. TrailingForeColorСвойство определяет цвет дат, которые предшествуют отображаемому месяцу или месяцам и следуют за ним. The TrailingForeColor property determines the color of the dates that precede and follow the displayed month or months.

Читайте также:  Aqua dock windows 10

Начиная с Windows Vista и в зависимости от темы, установка некоторых свойств может не изменить внешний вид календаря. Starting with Windows Vista and depending on the theme, setting some properties might not change the appearance of the calendar. Например, если в Windows настроено использование темы Aero, установка BackColor TitleBackColor свойств,, TitleForeColor или TrailingForeColor не оказывает никакого влияния. For example, if Windows is set to use the Aero theme, setting the BackColor, TitleBackColor, TitleForeColor, or TrailingForeColor properties has no effect. Это связано с тем, что обновленная версия календаря отображается с внешним видом, полученным во время выполнения из текущей темы операционной системы. This is because an updated version of the calendar is rendered with an appearance that is derived at run time from the current operating system theme. Если вы хотите использовать эти свойства и включить более раннюю версию календаря, можно отключить стили оформления для приложения. If you want to use these properties and enable the earlier version of the calendar, you can disable visual styles for your application. Отключение стилей оформления может повлиять на внешний вид и поведение других элементов управления в приложении. Disabling visual styles might affect the appearance and behavior of other controls in your application. Чтобы отключить стили оформления в Visual Basic, откройте конструктор проектов и снимите флажок включить стили Visual XP . To disable visual styles in Visual Basic, open the Project Designer and uncheck the Enable XP visual styles check box. Чтобы отключить стили оформления в C#, откройте Program.cs и закомментируйте комментарий Application.EnableVisualStyles(); . To disable visual styles in C#, open Program.cs and comment out Application.EnableVisualStyles(); . Дополнительные сведения о стилях оформления см. в разделе Включение визуальных стилей. For more information about visual styles, see Enabling Visual Styles.

Отображение текущей даты в нижней части элемента управления To display the current date at the bottom of the control

Задайте для свойства ShowToday значение true . Set the ShowToday property to true . Приведенный ниже пример переключает отображение и пропуск текущей даты при двойном щелчке на форме. The example below toggles between displaying and omitting today’s date when the form is double-clicked.

(Visual C#, Visual C++) Поместите следующий код в конструктор формы для регистрации обработчика событий. (Visual C#, Visual C++) Place the following code in the form’s constructor to register the event handler.

Отображение номеров недель To display week numbers

Задайте для свойства ShowWeekNumbers значение true . Set the ShowWeekNumbers property to true . Это свойство можно задать либо в коде, либо в окно свойств. You can set this property either in code or in the Properties window.

Номера недель отображаются в отдельном столбце слева от первого дня недели. Week numbers appear in a separate column to the left of the first day of the week.

Оцените статью