private void NgayPhatSong_EditDateModified(object sender, EventArgs e) { startDate = NgayPhatSong.SelectionStart; endDate = NgayPhatSong.SelectionEnd; selectDate = NgayPhatSong.Selection; if (startDate.DayOfWeek != DayOfWeek.Monday || NgayPhatSong.Selection.Count != 7) { while (startDate.DayOfWeek != DayOfWeek.Monday) { startDate = startDate.AddDays(-1); } NgayPhatSong.Selection.Clear(); NgayPhatSong.Selection.Add(startDate); endDate = startDate; for (int i = 1; i < 7; i++) { endDate = endDate.AddDays(1); NgayPhatSong.Selection.Add(endDate); } } }
private void Init() { InitializeComponent(); if (AppParams.ExcelVerion >= 12) { borderColor = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.FromArgb(178, 178, 178)); phimBgColor = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.FromArgb(242, 220, 219)); ctBgColor = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.FromArgb(146, 208, 80)); tietmucBgColor = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.FromArgb(217, 217, 217)); borderBgVTCV7 = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.FromArgb(22, 54, 92)); headerBgColorHTV =borderBgVTCV7; timeBgColorHTV = borderBgVTCV7; xlFormat = Excel.XlFileFormat.xlOpenXMLWorkbook; extension = ".xlsx"; } else { borderColor = System.Drawing.ColorTranslator.ToOle(Color.DarkGray); phimBgColor = System.Drawing.ColorTranslator.ToOle(Color.SandyBrown); ctBgColor = System.Drawing.ColorTranslator.ToOle(Color.Green); tietmucBgColor = System.Drawing.ColorTranslator.ToOle(Color.DarkGray); borderBgVTCV7 = System.Drawing.ColorTranslator.ToOle(Color.Blue); headerBgColorHTV = borderBgVTCV7; timeBgColorHTV = borderBgVTCV7; } selectDate = NgayPhatSong.Selection; startDate = NgayPhatSong.SelectionStart; endDate = NgayPhatSong.SelectionEnd; InitControls(); this.Load += new EventHandler(frmKhungLPSTuan_Load); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(frmInLPS_FormClosing); }
public CalendarDatesBindContext(Calendar calendar, DatesCollection collection) { Calendar = calendar; Collection = collection; Sync(); }
private void NgayPhatSong_EditDateModified(object sender, EventArgs e) { startDate = NgayPhatSong.SelectionStart; endDate = NgayPhatSong.SelectionEnd; selectDate = NgayPhatSong.Selection; int dCount = DateTime.DaysInMonth(startDate.Year, startDate.Month); if (startDate.Day != 1 || selectDate.Count != dCount) { while (startDate.Day != 1) { startDate = startDate.AddDays(-1); } NgayPhatSong.Selection.Clear(); NgayPhatSong.Selection.Add(startDate); endDate = startDate; while (endDate.Day < dCount) { endDate = endDate.AddDays(1); NgayPhatSong.Selection.Add(endDate); } } // Search(); }
public static void SetBindedDates(DependencyObject element, DatesCollection value) { element.SetValue(BindedDatesProperty, value); }