|
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace DatePicker
{
public class advancedDatePicker : System.Windows.Forms.DateTimePicker
{
private PopupWindowHelper popupHelper;
/// <summary>
/// Color of the DatePicker header
/// </summary>
[Description("Color of the DatePicker header")]
[Browsable(true), Category("DatePicker")]
public Color HeaderColor
{
get;
set;
}
public advancedDatePicker() : base()
{
popupHelper = new PopupWindowHelper();
Button btn = new Button();
btn.Dock = System.Windows.Forms.DockStyle.Right;
btn.Image = Properties.Resources.datePicker;
btn.Width = 28;
this.Controls.Add(btn);
btn.Click += btn_Click;
}
private void btn_Click(object sender, EventArgs e)
{
var btn = sender as Button;
Form f = FindForm();
var popup = new frmDatePicker(HeaderColor);
popup.cmb_Cal = this;
popup.CurrentDate = Convert.ToDateTime(Value);
Value = popup.CurrentDate;
Point location = PointToScreen(new Point(btn.Left-Width + btn.Width , btn.Bottom));
popupHelper.ShowPopup(f, popup, location);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.