Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
C# ПІДРУЧНИКИ / c# / Manning - Windows.forms.programming.with.c#.pdf
Скачиваний:
108
Добавлен:
12.02.2016
Размер:
14.98 Mб
Скачать

.NET Table 11.6 HitArea enumeration

The HitArea enumeration specifies the possible display areas in a MonthCalendar control. Typically, this is used when analyzing a specific point in a calendar control using the HitTest method. This enumeration is defined within the MonthCalendar class, and is part of the

System.Windows.Forms namespace.

Enumeration

Values

CalendarBackground

The specified point is part of the calendar’s

 

background.

Date

The specified point is part of a specific date of

 

the current month in the calendar. The Time

 

property of the

 

MonthCalendarInfo.HitTestInfo class is set

 

to the corresponding DateTime value.

DayOfWeek

The point is part of a day abbreviation, such as

 

“Mon.” The Time property should contain the

 

date on the top row of the calendar.

NextMonthButton

The point is part of the next month button at the

 

top right of the control.

NextMonthDate

The point is part of a date from the next month in

 

the control.

Nowhere

The point is not in the MonthCalendar control,

 

nor is it in an active portion of the control. This is

 

the default.

PrevMonthButton

The point is part of the previous month button at

 

the top left of the control.

PrevMonthDate

The point is part of a date from the previous

 

month in the control.

TitleBackground

The point is over the background of a month’s

 

title.

TitleMonth

The point is over a month name in the title of the

 

control.

TitleYear

The point is over a year value in the title of the

 

control.

TodayLink

The point is over the “today” link at the bottom

 

of the control.

WeekNumbers

The point is over a week number when these

 

values are displayed. The Time property should

 

contain the first date of that week.

 

 

11.5RECAP

In this chapter we created tab controls and tab pages dynamically and using Visual Studio .NET. We modified our MyAlbumEditor application to use a tab control in place of the Photographs group box used in chapter 10. We then added a second tab to contain a calendar control displaying the dates when photographs in the album

RECAP

381

were taken, and permitted the user to click on a date to view the properties associated with the corresponding photographs.

We also examined the DateTimePicker class, and used this control in our PhotoEditDlg form to present the DateTaken property of a Photograph object. This led to a discussion of the formats used to display custom date-time strings.

In chapter 12 we will take up an assortment of different topics related to Windows Forms application development.

382

CHAPTER 11 MORE CONTROLS

C H A P T E R

1 2

 

 

A .NET assortment

12.1Keyboard events 384

12.2Mouse events 387

12.3Image buttons 393

12.4Icons 405

12.5Recap 409

In the last three chapters we looked at various controls available in the Windows Forms namespace, and demonstrated the use of these controls in applications. In this chapter we take a break from this aspect of Windows Forms development, and turn our attention to interacting with the keyboard and mouse, and the placement of images within certain controls.

For this discussion we return to the MyPhotos application we left in chapter 9. As usual, the Visual Studio.NET solution is available on the book’s web site in case you have misplaced your copy. We will examine the following topics:

Keyboard events

Mouse events

Placing images on button controls

Icons in a form and an application

Our discussion will present each concept in a separate section, beginning with the keyboard events.

383

Соседние файлы в папке c#