0

我正在尝试制作MonthCalendarC++ CLI并且我发现了如何做到这一点,但是当我运行我的应用程序时,有四个MonthCalendars. 我只想要一个,我找不到任何方法来改变它。只有我能做的就是改变日历(smaller == less calendars)的大小。我应该怎么做才能制作"n"我想要的大小的日历?

制作类的实例:

this->kalendarz = gcnew System::Windows::Forms::MonthCalendar();

初始化对象:

this->kalendarz = gcnew System::Windows::Forms::MonthCalendar();
this->kalendarz->AnnuallyBoldedDates = gcnew cli::array < System::DateTime >(1)
                { System::DateTime(2004,7,4,0,0,0,0)};
this->kalendarz->CalendarDimensions = System::Drawing::Size(2,2);
this->kalendarz->Location = System::Drawing::Point(1,30);
this->kalendarz->MaxSelectionCount = 365;
this->kalendarz->MonthlyBoldedDates = gcnew cli::array < System::DateTime  >(2)
{ System::DateTime(2004,7,4,0,0,0,0), System::DateTime(2004,7,4,0,0,0,0) };
this->kalendarz->Name = L"kalendarz";
this->kalendarz->ShowWeekNumbers = true;
this->kalendarz->Size = System::Drawing::Size(210,297);
this->kalendarz->TabIndex = 3;

================

this->kalendarz->Size = System::Drawing::Size(410,297); == 4 calendars
this->kalendarz->Size = System::Drawing::Size(210,297); == 2 calendars
4

1 回答 1

1

MonthCalendar.SetCalendarDimensions应该得到你想要的:

this->kalendarz->SetCalendarDimensions(1, 1);

它设置应显示的月份的行数和列数。应该和这个一样:

this->kalendarz->CalendarDimensions = System::Drawing::Size(1, 1);

...我刚刚注意到您2,2在示例中已设置为,因此只需将其更改为1,1.

于 2012-08-17T12:28:21.777 回答