MonthCalendar.AddBoldedDate(DateTime) Yöntem
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
Ay takviminde kalın olarak görüntülenecek bir gün ekler.
public:
void AddBoldedDate(DateTime date);
public void AddBoldedDate (DateTime date);
member this.AddBoldedDate : DateTime -> unit
Public Sub AddBoldedDate (date As DateTime)
Parametreler
- date
- DateTime
Kalın olarak görüntülenecek tarih.
Örnekler
Aşağıdaki kod örneği, dosyadan okunan kalın yazı tipi tarihlerini işaretlemek ve görüntülemek için ve UpdateBoldedDates yöntemlerini kullanırAddBoldedDate. Bu örnek, adlı monthCalendar1
bir MonthCalendar denetimin öğesine eklenmesini Form ve bu yöntemin forma yerleştirilmesini ve ondan çağrılmayı gerektirir.
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
Açıklamalar
Görüntüyü güncelleştirmek için daha sonra yöntemini çağırmanız UpdateBoldedDates gerekir.
Tek bir atamaya birden çok tarih eklemek için özelliğine BoldedDates bir nesne dizisi DateTime atayabilirsiniz.