internal void MouseClick(Point mouseLocation, MouseButtons button, NuGenClickMode mode) { GregorianCalendar gCalendar = new GregorianCalendar(); if (m_region.IsVisible(mouseLocation)) { int week = 0; int i = ((mouseLocation.Y - m_rect.Top) / (int)m_calendar.Month.DayHeight); week = gCalendar.GetWeekOfYear(m_calendar.Month.m_days[i * 7].Date, m_calendar._dateTimeFormat.CalendarWeekRule, m_calendar._dateTimeFormat.FirstDayOfWeek); if (mode == NuGenClickMode.Single) { if (this.Click != null) { this.Click(this, new NuGenWeeknumberClickEventArgs(week, button)); } } else { if (this.DoubleClick != null) { this.DoubleClick(this, new NuGenWeeknumberClickEventArgs(week, button)); } } } }
internal void MouseClick(Point mouseLocation, MouseButtons button, NuGenClickMode mode) { if (m_region.IsVisible(mouseLocation)) { if (mode == NuGenClickMode.Single) { if (this.Click != null) this.Click(this, new NuGenClickEventArgs(button)); } else { if (this.DoubleClick != null) this.DoubleClick(this, new NuGenClickEventArgs(button)); } } }
internal void MouseClick(Point mouseLocation, MouseButtons button, NuGenClickMode mode) { if (m_region.IsVisible(mouseLocation)) { if (mode == NuGenClickMode.Single) { if (this.Click != null) { this.Click(this, new NuGenClickEventArgs(button)); } } else { if (this.DoubleClick != null) { this.DoubleClick(this, new NuGenClickEventArgs(button)); } } } }
internal void MouseClick(Point mouseLocation, MouseButtons button, NuGenClickMode mode) { if (m_region.IsVisible(mouseLocation)) { int day; day = (mouseLocation.X / (int)m_calendar.Month.DayWidth); if (mode == NuGenClickMode.Single) { if (this.Click != null) { this.Click(this, new NuGenWeekdayClickEventArgs(day, button)); } } else { if (this.DoubleClick != null) { this.DoubleClick(this, new NuGenWeekdayClickEventArgs(day, button)); } } } }
internal void MouseClick(Point mouseLocation, MouseButtons button, NuGenClickMode mode) { if (m_region.IsVisible(mouseLocation)) { int day; day = (mouseLocation.X / (int)m_calendar.Month.DayWidth); if (mode == NuGenClickMode.Single) { if (this.Click != null) this.Click(this, new NuGenWeekdayClickEventArgs(day, button)); } else { if (this.DoubleClick != null) this.DoubleClick(this, new NuGenWeekdayClickEventArgs(day, button)); } } }
internal void MouseClick(Point mouseLocation, MouseButtons button, NuGenClickMode mode) { Region leftBtnRgn = new Region(_prevBtnRect); Region rightBtnRgn = new Region(_nextBtnRect); Region leftYearBtnRgn = new Region(_prevYearBtnRect); Region rightYearBtnRgn = new Region(_nextYearBtnRect); MouseButtons selectButton; if (SystemInformation.MouseButtonsSwapped) { selectButton = MouseButtons.Right; } else { selectButton = MouseButtons.Left; } bool btnClick = false; if (_region.IsVisible(mouseLocation)) { if (button == selectButton) { if (_monthSelector) { if ((leftBtnRgn.IsVisible(mouseLocation)) && (_prevBtnState != HeaderButtonState.Inactive) && (_prevBtnState != HeaderButtonState.Pushed)) { _prevBtnState = HeaderButtonState.Pushed; if (this.PrevMonthButtonClick != null) { this.PrevMonthButtonClick(this, new EventArgs()); } btnClick = true; } if ((rightBtnRgn.IsVisible(mouseLocation)) && (_nextBtnState != HeaderButtonState.Inactive) && (_nextBtnState != HeaderButtonState.Pushed)) { _nextBtnState = HeaderButtonState.Pushed; if (this.NextMonthButtonClick != null) { this.NextMonthButtonClick(this, new EventArgs()); } btnClick = true; } } if (_yearSelector) { if ((leftYearBtnRgn.IsVisible(mouseLocation)) && (_prevYearBtnState != HeaderButtonState.Inactive) && (_prevYearBtnState != HeaderButtonState.Pushed)) { _prevYearBtnState = HeaderButtonState.Pushed; if (this.PrevYearButtonClick != null) { this.PrevYearButtonClick(this, new EventArgs()); } btnClick = true; } if ((rightYearBtnRgn.IsVisible(mouseLocation)) && (_nextYearBtnState != HeaderButtonState.Inactive) && (_nextYearBtnState != HeaderButtonState.Pushed)) { _nextYearBtnState = HeaderButtonState.Pushed; if (this.NextYearButtonClick != null) { this.NextYearButtonClick(this, new EventArgs()); } btnClick = true; } } } else { if (_contextMenu) { DisplayMonthContextMenu(mouseLocation); } } if (mode == NuGenClickMode.Single) { if ((this.Click != null) && (!btnClick)) { this.Click(this, new NuGenClickEventArgs(button)); } } else { if ((this.DoubleClick != null) && (!btnClick)) { this.DoubleClick(this, new NuGenClickEventArgs(button)); } } } leftBtnRgn.Dispose(); rightBtnRgn.Dispose(); leftYearBtnRgn.Dispose(); rightYearBtnRgn.Dispose(); }
internal void MouseClick(Point mouseLocation, MouseButtons button, NuGenClickMode mode) { Region leftBtnRgn = new Region(_prevBtnRect); Region rightBtnRgn = new Region(_nextBtnRect); Region leftYearBtnRgn = new Region(_prevYearBtnRect); Region rightYearBtnRgn = new Region(_nextYearBtnRect); MouseButtons selectButton; if (SystemInformation.MouseButtonsSwapped) selectButton = MouseButtons.Right; else selectButton = MouseButtons.Left; bool btnClick = false; if (_region.IsVisible(mouseLocation)) { if (button == selectButton) { if (_monthSelector) { if ((leftBtnRgn.IsVisible(mouseLocation)) && (_prevBtnState != HeaderButtonState.Inactive) && (_prevBtnState != HeaderButtonState.Pushed)) { _prevBtnState = HeaderButtonState.Pushed; if (this.PrevMonthButtonClick != null) this.PrevMonthButtonClick(this, new EventArgs()); btnClick = true; } if ((rightBtnRgn.IsVisible(mouseLocation)) && (_nextBtnState != HeaderButtonState.Inactive) && (_nextBtnState != HeaderButtonState.Pushed)) { _nextBtnState = HeaderButtonState.Pushed; if (this.NextMonthButtonClick != null) this.NextMonthButtonClick(this, new EventArgs()); btnClick = true; } } if (_yearSelector) { if ((leftYearBtnRgn.IsVisible(mouseLocation)) && (_prevYearBtnState != HeaderButtonState.Inactive) && (_prevYearBtnState != HeaderButtonState.Pushed)) { _prevYearBtnState = HeaderButtonState.Pushed; if (this.PrevYearButtonClick != null) this.PrevYearButtonClick(this, new EventArgs()); btnClick = true; } if ((rightYearBtnRgn.IsVisible(mouseLocation)) && (_nextYearBtnState != HeaderButtonState.Inactive) && (_nextYearBtnState != HeaderButtonState.Pushed)) { _nextYearBtnState = HeaderButtonState.Pushed; if (this.NextYearButtonClick != null) this.NextYearButtonClick(this, new EventArgs()); btnClick = true; } } } else { if (_contextMenu) { DisplayMonthContextMenu(mouseLocation); } } if (mode == NuGenClickMode.Single) { if ((this.Click != null) && (!btnClick)) this.Click(this, new NuGenClickEventArgs(button)); } else { if ((this.DoubleClick != null) && (!btnClick)) this.DoubleClick(this, new NuGenClickEventArgs(button)); } } leftBtnRgn.Dispose(); rightBtnRgn.Dispose(); leftYearBtnRgn.Dispose(); rightYearBtnRgn.Dispose(); }