Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Fügt einen Tag hinzu, der im Monatskalender fett formatiert angezeigt werden soll.
Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)
Syntax
'Declaration
Public Sub AddBoldedDate ( _
date As DateTime _
)
'Usage
Dim instance As MonthCalendar
Dim date As DateTime
instance.AddBoldedDate(date)
public void AddBoldedDate (
DateTime date
)
public:
void AddBoldedDate (
DateTime date
)
public void AddBoldedDate (
DateTime date
)
public function AddBoldedDate (
date : DateTime
)
Parameter
- date
Das mit fetter Formatierung anzuzeigende Datum.
Hinweise
Anschließend müssen Sie die UpdateBoldedDates-Methode aufrufen, um die Anzeige zu aktualisieren.
Um in einer einzelnen Zuweisung mehrere Datumsangaben hinzuzufügen, können Sie der BoldedDates-Eigenschaft ein Array von DateTime-Objekten zuweisen.
Beispiel
Im folgenden Codebeispiel werden die AddBoldedDate-Methode und die UpdateBoldedDates-Methode verwendet, um die aus einer Datei eingelesenen Datumsangaben zu markieren und fett formatiert anzuzeigen. Für dieses Beispiel muss einem Form das MonthCalendar-Steuerelement monthCalendar1 hinzugefügt werden; außerdem muss diese Methode im Formular platziert und aus diesem aufgerufen werden.
' 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
Plattformen
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0
Siehe auch
Referenz
MonthCalendar-Klasse
MonthCalendar-Member
System.Windows.Forms-Namespace
UpdateBoldedDates
BoldedDates