本文整理汇总了C#中System.Windows.Forms.MonthCalendar.AddBoldedDate方法的典型用法代码示例。如果您正苦于以下问题:C# MonthCalendar.AddBoldedDate方法的具体用法?C# MonthCalendar.AddBoldedDate怎么用?C# MonthCalendar.AddBoldedDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.MonthCalendar
的用法示例。
在下文中一共展示了MonthCalendar.AddBoldedDate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddBoldedDateTest
public void AddBoldedDateTest ()
{
Form myForm = new Form ();
myForm.ShowInTaskbar = false;
MonthCalendar myMonthCal = new MonthCalendar ();
myMonthCal.AddBoldedDate (new DateTime (2005, 09, 02));
myForm.Controls.Add (myMonthCal);
Assert.AreEqual (new DateTime (2005, 09, 02), myMonthCal.BoldedDates.GetValue (0), "#add2");
myForm.Dispose ();
}
示例2: MonthCalendarPropertyTest
public void MonthCalendarPropertyTest ()
{
Form myfrm = new Form ();
myfrm.ShowInTaskbar = false;
MonthCalendar myMonthCal1 = new MonthCalendar ();
//MonthCalendar myMonthCal2 = new MonthCalendar ();
myMonthCal1.Name = "MonthCendar";
myMonthCal1.TabIndex = 1;
//DateTime myDateTime = new DateTime ();
// A
Assert.IsNotNull (myMonthCal1.AnnuallyBoldedDates, "#A-1");
myMonthCal1.AddAnnuallyBoldedDate (new DateTime (2005, 09, 01));
Assert.IsNotNull (myMonthCal1.AnnuallyBoldedDates, "#A0");
Assert.AreEqual (new DateTime (2005, 09, 01), myMonthCal1.AnnuallyBoldedDates.GetValue (0), "#A1");
// B
Assert.AreEqual ("Window", myMonthCal1.BackColor.Name, "#B1");
myMonthCal1.AddBoldedDate (new DateTime (2005, 09, 01));
Assert.AreEqual (new DateTime (2005, 09, 01), myMonthCal1.BoldedDates.GetValue (0), "#B2");
// C
Assert.AreEqual (1, myMonthCal1.CalendarDimensions.Height, "#C1");
Assert.AreEqual (1, myMonthCal1.CalendarDimensions.Width, "#C2");
Assert.AreEqual (false, myMonthCal1.CalendarDimensions.IsEmpty, "#C3");
// F
Assert.AreEqual (Day.Default, myMonthCal1.FirstDayOfWeek, "#F1");
myMonthCal1.FirstDayOfWeek = Day.Sunday;
Assert.AreEqual (Day.Sunday, myMonthCal1.FirstDayOfWeek, "#F2");
Assert.AreEqual ("WindowText", myMonthCal1.ForeColor.Name, "#F3");
// M
Assert.AreEqual (new DateTime (9998,12,31), myMonthCal1.MaxDate, "#M1");
Assert.AreEqual (7, myMonthCal1.MaxSelectionCount, "#M2");
Assert.AreEqual (new DateTime (1753,1,1), myMonthCal1.MinDate, "#M3");
myMonthCal1.AddMonthlyBoldedDate (new DateTime (2005, 09, 01));
Assert.AreEqual (new DateTime(2005, 09, 01), myMonthCal1.MonthlyBoldedDates.GetValue (0), "#M4");
// S
Assert.AreEqual (0, myMonthCal1.ScrollChange, "#S1");
myMonthCal1.SelectionStart = new DateTime (2005,09,02);
myMonthCal1.SelectionEnd = new DateTime (2005,09,03);
Assert.AreEqual (new DateTime (2005,09,03), myMonthCal1.SelectionEnd, "#S2");
//Assert.AreEqual (new SelectionRange (new DateTime(2005,09,02), new DateTime(2005,09,03)), myMonthCal1.SelectionRange, "#S3");
Assert.AreEqual (new DateTime (2005,09,02), myMonthCal1.SelectionStart, "#S4");
Assert.AreEqual (true, myMonthCal1.ShowToday, "#S5");
Assert.AreEqual (true, myMonthCal1.ShowTodayCircle, "#S6");
Assert.AreEqual (false, myMonthCal1.ShowWeekNumbers, "#S7");
// Font dependent. // Assert.AreEqual (153, myMonthCal1.SingleMonthSize.Height, "#S8a");
// Font dependent. // Assert.AreEqual (176, myMonthCal1.SingleMonthSize.Width, "#S8b");
Assert.AreEqual (null, myMonthCal1.Site, "#S9");
// T
Assert.AreEqual ("ActiveCaption", myMonthCal1.TitleBackColor.Name, "#T1");
Assert.AreEqual ("ActiveCaptionText", myMonthCal1.TitleForeColor.Name, "#T2");
Assert.AreEqual (DateTime.Today, myMonthCal1.TodayDate, "#T3");
Assert.AreEqual (false, myMonthCal1.TodayDateSet, "#T4");
Assert.AreEqual ("GrayText", myMonthCal1.TrailingForeColor.Name, "#T5");
myfrm.Dispose ();
}
示例3: RemoveBoldedDateTest
public void RemoveBoldedDateTest ()
{
MonthCalendar myMonthCal = new MonthCalendar ();
DateTime[] dts = new DateTime [10];
dts[0] = new DateTime (2001, 02, 03, 04, 05, 06, 07); // base datetime
dts[1] = new DateTime (2001, 02, 03); // only date
dts[2] = new DateTime (2002, 03, 04); // only date, different
dts[3] = new DateTime (2002, 02, 03, 04, 05, 06, 07); // different year
dts[4] = new DateTime (2001, 03, 03, 04, 05, 06, 07); // different month
dts[5] = new DateTime (2001, 02, 04, 04, 05, 06, 07); // etc...
dts[6] = new DateTime (2001, 02, 03, 05, 05, 06, 07);
dts[7] = new DateTime (2001, 02, 03, 04, 06, 06, 07);
dts[8] = new DateTime (2001, 02, 03, 04, 05, 07, 07);
dts[9] = new DateTime (2001, 02, 03, 04, 05, 06, 08);
for (int i = 0; i < dts.Length; i++)
{
for (int j = 0; j < dts.Length; j++)
{
myMonthCal.RemoveAllBoldedDates ();
myMonthCal.AddBoldedDate (dts [j]);
myMonthCal.RemoveBoldedDate (dts [i]);
if (dts [j].Month == dts [i].Month && dts [j].Day == dts [i].Day && dts[j].Year == dts[i].Year)
Assert.AreEqual (0, myMonthCal.BoldedDates.Length, "#remove0" + i.ToString () + ", " + j.ToString ());
else
Assert.AreEqual (1, myMonthCal.BoldedDates.Length, "#remove0" + i.ToString () + ", " + j.ToString ());
}
}
for (int i = 0; i < dts.Length; i++)
{
myMonthCal.BoldedDates = dts;
myMonthCal.RemoveBoldedDate (dts [i]);
Assert.AreEqual (9, myMonthCal.BoldedDates.Length, "#remove1" + i.ToString ());
}
}