DataTime BoldedDates : MonthCalendar « GUI Windows Forms « C# / CSharp Tutorial

Home
C# / CSharp Tutorial
1.Language Basics
2.Data Type
3.Operator
4.Statement
5.String
6.struct
7.Class
8.Operator Overload
9.delegate
10.Attribute
11.Data Structure
12.Assembly
13.Date Time
14.Development
15.File Directory Stream
16.Preprocessing Directives
17.Regular Expression
18.Generic
19.Reflection
20.Thread
21.I18N Internationalization
22.LINQ
23.GUI Windows Forms
24.Windows Presentation Foundation
25.Windows Communication Foundation
26.Workflow
27.2D
28.Design Patterns
29.Windows
30.XML
31.XML LINQ
32.ADO.Net
33.Network
34.Directory Services
35.Security
36.unsafe
C# / C Sharp
C# / C Sharp by API
C# / CSharp Open Source
C# / CSharp Tutorial » GUI Windows Forms » MonthCalendar 
23.15.1.DataTime BoldedDates
DataTime BoldedDates
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }

    private void addButton_Click(object sender, EventArgs e)
    {
        System.DateTime[] boldDates = new System.DateTime[monthCalendar.BoldedDates.Length + 1];
        int i =0;
        foreach (DateTime currentDate in monthCalendar.BoldedDates)
        {
            boldDates[i= currentDate;
            i++;
        }
        boldDates[i= System.DateTime.Parse(specialDate.Text);
        monthCalendar.BoldedDates = boldDates;
    }

    private void monthCalendar_DateSelected(object sender, DateRangeEventArgs e)
    {
        specialDate.Text = e.Start.ToLongDateString();
    }
}
partial class Form1
{
    private void InitializeComponent()
    {
        System.Windows.Forms.Label label1;
        System.Windows.Forms.Button addButton;
        this.monthCalendar = new System.Windows.Forms.MonthCalendar();
        this.specialDate = new System.Windows.Forms.DateTimePicker();
        label1 = new System.Windows.Forms.Label();
        addButton = new System.Windows.Forms.Button();
        this.SuspendLayout();
        // 
        // label1
        // 
        label1.AutoSize = true;
        label1.Location = new System.Drawing.Point(1216);
        label1.Name = "label1";
        label1.Size = new System.Drawing.Size(9013);
        label1.TabIndex = 2;
        label1.Text = "Pick a date to add";
        // 
        // addButton
        // 
        addButton.Location = new System.Drawing.Point(2899);
        addButton.Name = "addButton";
        addButton.Size = new System.Drawing.Size(7523);
        addButton.TabIndex = 3;
        addButton.Text = "Add";
        addButton.Click += new System.EventHandler(this.addButton_Click);
        // 
        // monthCalendar
        // 
        this.monthCalendar.CalendarDimensions = new System.Drawing.Size(33);
        this.monthCalendar.Location = new System.Drawing.Point(1874);
        this.monthCalendar.Name = "monthCalendar";
        this.monthCalendar.Size = new System.Drawing.Size(542439);
        this.monthCalendar.TabIndex = 0;
        this.monthCalendar.DateSelected += new System.Windows.Forms.DateRangeEventHandler(this.monthCalendar_DateSelected);
        // 
        // specialDate
        // 
        this.specialDate.Location = new System.Drawing.Point(10812);
        this.specialDate.Name = "specialDate";
        this.specialDate.Size = new System.Drawing.Size(17520);
        this.specialDate.TabIndex = 1;
        // 
        // Form1
        // 
        this.AutoScaleDimensions = new System.Drawing.SizeF(6F13F);
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
        this.ClientSize = new System.Drawing.Size(573529);
        this.Controls.Add(addButton);
        this.Controls.Add(label1);
        this.Controls.Add(this.specialDate);
        this.Controls.Add(this.monthCalendar);
        this.Name = "Form1";
        this.Text = "Form1";
        this.ResumeLayout(false);
        this.PerformLayout();

    }

    private System.Windows.Forms.MonthCalendar monthCalendar;
    private System.Windows.Forms.DateTimePicker specialDate;
}
public class DataTimePickerBoldedDates
{
    [STAThread]
    static void Main()
    {
        Application.EnableVisualStyles();
        Application.Run(new Form1());
    }
}
23.15.MonthCalendar
23.15.1.DataTime BoldedDatesDataTime BoldedDates
23.15.2.Put MonthCalendar On a FormPut MonthCalendar On a Form
23.15.3.Get start and end selection on a MonthCalendar
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.