using HotelPms.Share.Util;
|
using HotelPms.Share.Windows.Component;
|
using HotelPms.Share.Windows.Util;
|
using System;
|
using System.Collections.Generic;
|
using System.ComponentModel;
|
using System.Data;
|
using System.Drawing;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using System.Windows.Forms;
|
|
namespace HotelPms.Share.Windows.Tool
|
{
|
public partial class CalendarSelector : FormBase
|
{
|
public DateTime SelDate { get; set; } = DateTime.Now;
|
public Control OwnerControl { get; set; } = null;
|
|
public CalendarSelector(Control obj)
|
{
|
InitializeComponent();
|
OwnerControl = obj;
|
}
|
|
private void Calendar1_DateSelect(object sender, CalendarEventArgs e)
|
{
|
SelDate = calendar1.Value;
|
OwnerControl.Text = calendar1.Text;
|
this.DialogResult = DialogResult.OK;
|
}
|
|
private void CalendarSelector_Load(object sender, EventArgs e)
|
{
|
calendar1.Value = CConvert.ToDateTime(OwnerControl.Text);
|
//Point location = this.Location;
|
//GeneralSub.GetLocationToScreen(OwnerControl, ref location);
|
//this.Location = location;
|
}
|
|
public static DialogResult Execute(Control obj)
|
{
|
using (CalendarSelector form = new CalendarSelector(obj))
|
{
|
return form.ShowDialog();
|
}
|
}
|
|
private void Calendar1_DayCellFormat(object sender, CalendarEventArgs e)
|
{
|
if (e.DateValue.ToString("MMdd") == "0101") { e.Holiday = "元旦"; }
|
}
|
}
|
}
|