Example #1
0
        public MainForm()
        {
            InitializeComponent();

            // set up some bolded dates
            monthcal1.BoldedDates = new DateTime [] { DateTime.Now, DateTime.Now.AddDays(2) };
            monthcal2.AddMonthlyBoldedDate(DateTime.Now);
            monthcal2.AddMonthlyBoldedDate(DateTime.Now.AddDays(2));
            monthcal2.AddMonthlyBoldedDate(DateTime.Now.AddDays(5));
            monthcal2.UpdateBoldedDates();

            monthcal3.AddAnnuallyBoldedDate(DateTime.Now.AddDays(-2));
            monthcal3.AddAnnuallyBoldedDate(DateTime.Now.AddDays(-5));
            monthcal3.UpdateBoldedDates();
            monthcal2.RemoveMonthlyBoldedDate(DateTime.Now.AddDays(2));
            monthcal2.UpdateBoldedDates();

            // test the scroll change property
            monthcal2.ScrollChange = 2;
        }
Example #2
0
        //<Snippet2>
        // 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);
            }
        }