首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在我的MonthCalendar上获取BoldedDates?

如何在我的MonthCalendar上获取BoldedDates?
EN

Stack Overflow用户
提问于 2017-02-06 03:53:19
回答 1查看 1.2K关注 0票数 0

我正试着在我的MonthCalendar上加粗一些日期。我确实从我的文件名中完美地获得了所有的日期,但似乎就是不能加粗单元格。有没有人能解释一下我做错了什么?下面是我在Form_Load函数上使用的代码:

代码语言:javascript
复制
        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();

提前谢谢!

EN

回答 1

Stack Overflow用户

发布于 2017-02-06 04:11:10

您可能只想使用月份日历控件

下面是一个可以提供帮助的代码:

代码语言:javascript
复制
DateTime[] myDates = {myDate1, myDate2};

calendar.BoldedDates = myDates;

希望这能有所帮助。请参阅Here

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42056539

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档