| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- using System;
- using System.Windows.Forms;
- namespace Core.StlMes.Client.LgCommon
- {
- public partial class frmSetTime : Form
- {
- public frmSetTime(object value)
- {
- InitializeComponent();
- DateTime dt = DateTime.Now;
- try
- {
- if (value != null) dt = (DateTime)value;
- else dt = DateTime.Now;
- }
- catch
- {
- dt = DateTime.Now;
- }
- this.dateTimePicker1.Value = dt;
- this.monthCalendar1.SetDate(dt.Date);
- }
- public DateTime SelectDate
- {
- get
- {
- return this.dateTimePicker1.Value;
- }
- }
- private void BtnOK_Click(object sender, EventArgs e)
- {
- this.DialogResult = DialogResult.OK;
- this.Close();
- }
- private void BtnCancel_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- private void monthCalendar1_DateSelected(object sender, DateRangeEventArgs e)
- {
- try
- {
- DateTime time = this.dateTimePicker1.Value;
- this.dateTimePicker1.Value = this.monthCalendar1.SelectionEnd.Date.AddHours(time.Hour).AddMinutes(time.Minute).AddSeconds(time.Second);
- }
- catch { }
- }
- private void btnNow_Click(object sender, EventArgs e)
- {
- dateTimePicker1.Value = DateTime.Now;
- }
- }
- }
|