MonthCalendar.AddBoldedDate メソッド
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)


表示を更新するために、後で UpdateBoldedDates メソッドを呼び出す必要があります。
複数の日付を 1 回の割り当てによって追加するために、DateTime オブジェクトの配列を BoldedDates プロパティに割り当てることができます。

AddBoldedDate メソッドおよび UpdateBoldedDates メソッドを使用して、ファイルから読み取った日付をマークし、太字フォントで表示するコード例を次に示します。この例では、monthCalendar1 という名前の MonthCalendar コントロールが Form に追加されており、このメソッドがそのフォーム内に含まれ、そこから呼び出される必要があります。
' 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 Not myInput Is 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
// 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); } }
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.get_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); } } //LoadDates

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からMonthCalendar.AddBoldedDate メソッドを検索する場合は、下記のリンクをクリックしてください。

- MonthCalendar.AddBoldedDate メソッドのページへのリンク