MonthCalendar.AddBoldedDate(DateTime) MonthCalendar.AddBoldedDate(DateTime) MonthCalendar.AddBoldedDate(DateTime) MonthCalendar.AddBoldedDate(DateTime) Method

定義

月間予定表に太字で表示される日付を追加します。Adds a day to be displayed in bold in the month calendar.

public:
 void AddBoldedDate(DateTime date);
public void AddBoldedDate (DateTime date);
member this.AddBoldedDate : DateTime -> unit
Public Sub AddBoldedDate (date As DateTime)

パラメーター

date
DateTime DateTime DateTime DateTime

太字で表示される日付。The date to be displayed in bold.

次のコード例では、AddBoldedDateUpdateBoldedDatesファイルからの読み取りの日付を太字フォントで表示し、マークするメソッド。The following code example uses the AddBoldedDate and UpdateBoldedDates methods to mark and display in a bold font dates read from a file. この例では、する必要があります、MonthCalendarという名前のコントロールmonthCalendar1に追加された、Formし、このメソッドは、フォーム内に配置し、そこから呼び出されます。This example requires that a MonthCalendar control, named monthCalendar1, has been added to a Form and that this method is placed within the form and called from it.

private:
   // The following method uses Add to add dates that are 
   // bolded, followed by an UpdateBoldedDates to make the
   // added dates visible.
   void loadDates()
   {
      String^ myInput;
      try
      {
         StreamReader^ myInputStream = File::OpenText( "myDates.txt" );
         while ( (myInput = myInputStream->ReadLine()) != nullptr )
         {
            monthCalendar1->AddBoldedDate( DateTime::Parse( myInput->Substring( 0, myInput->IndexOf( " " ) ) ) );
            listBox1->Items->Add( myInput );
         }
         monthCalendar1->UpdateBoldedDates();
         myInputStream->Close();
         File::Delete( "myDates.txt" );
      }
      catch ( FileNotFoundException^ fnfe ) 
      {
         
         // Code to handle a file that could not be found should go here.
         Console::WriteLine( "An error occurred: '{0}'", fnfe );
      }

   }
// The following method uses Add to add dates that are 
// bolded, followed by an UpdateBoldedDates to make the
// added dates visible.

private void loadDates()
{
    String myInput ;
    try
    {
        StreamReader myInputStream = File.OpenText("myDates.txt");
        while((myInput = myInputStream.ReadLine()) != null)
        {
            monthCalendar1.AddBoldedDate(DateTime.Parse(myInput.Substring(0,myInput.IndexOf(" "))));
            listBox1.Items.Add(myInput);
        }
        monthCalendar1.UpdateBoldedDates();
        myInputStream.Close();
        File.Delete("myDates.txt");
    }catch(FileNotFoundException fnfe)
    {
        // Code to handle a file that could not be found should go here.
    Console.WriteLine("An error occurred: '{0}'", fnfe);
    }             
}
' The following method uses Add to add dates that are 
' bolded, followed by an UpdateBoldedDates to make the
' added dates visible.
Private Sub loadDates()
   Dim myInput As [String]
   Try
      Dim myInputStream As StreamReader = File.OpenText("myDates.txt")
      myInput = myInputStream.ReadLine()
      While myInput IsNot Nothing
         monthCalendar1.AddBoldedDate(DateTime.Parse(myInput.Substring(0, myInput.IndexOf(" "))))
         listBox1.Items.Add(myInput)
         myInput = myInputStream.ReadLine()
      End While
      monthCalendar1.UpdateBoldedDates()
      myInputStream.Close()
      File.Delete("myDates.txt")
   Catch fnfe As FileNotFoundException
   End Try
End Sub 'loadDates

注釈

呼び出す必要があります、UpdateBoldedDates表示を更新するには、その後のメソッド。You must call the UpdateBoldedDates method afterward to update the display.

単一のリソース割り当てには、複数の日付を追加するには、配列を割り当てることができますDateTimeオブジェクトをBoldedDatesプロパティ。To add multiple dates in a single assignment, you can assign an array of DateTime objects to the BoldedDates property.

適用対象

こちらもご覧ください