私はMonthCalendarでいくつかの日付を太字で表示しようとしています。私はすべての日付をファイル名から完全に取得しますが、私はちょうど細胞を太字にすることはできません。何が間違っているのかを私に説明できる人はいますか? ここで私は私のForm_Load関数に使用しているコードは次のとおりです。事前による私のMonthCalendarでBoldedDatesを取得するには?
MonthCalendar c = new MonthCalendar();
lbl_date.Text = c.TodayDate.ToString("dd/MM/yyyy");
loadEventDisplay();
string dirPath = @"E:\Calendar\";
List<string> files = new List<string>(Directory.EnumerateFiles(dirPath));
foreach (var file in files)
{
string year = file.Substring(18, 4);
string month = file.Substring(15, 2);
string day = file.Substring(12, 2);
DateTime[] dt = new DateTime[]
{
new DateTime(Int32.Parse(year), Int32.Parse(month), Int32.Parse(day))
};
// The date format I am using on that line is actually the same that works with the graphic interface
c.AddBoldedDate(DateTime.Parse(day+"/"+month+"/"+year));
c.UpdateBoldedDates();
ありがとう!あなたはちょうどここにおそらく
を月間カレンダーコントロールを使用したい
対象とするもの:Winforms、WPF、ASP ..? __Always__あなたの質問に正しくタグを付けてください! – TaW
コードは正常です。ほとんどの場合、あなたの日付はそうではありません。しかし、もちろん、配列を常に初期化するのは意味がありません。代わりに、リストを使用し、ループの外側でそれを宣言し、ループの後にas.ToaRRay()を追加してください! –
TaW
私はそのようにしてきましたが、BoldedDatesプロパティが機能していないようです。とにかくお時間をありがとう。 –