protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); Point p = new Point(e.X, e.Y); mcItemAlign select = mcItemAlign.Center; bool hit = false; if (m_topLeftRgn.IsVisible(p)) { select = mcItemAlign.TopLeft; hit = true; } if (m_topRightRgn.IsVisible(p)) { select = mcItemAlign.TopRight; hit = true; } if (m_bottomLeftRgn.IsVisible(p)) { select = mcItemAlign.BottomLeft; hit = true; } if (m_bottomRightRgn.IsVisible(p)) { select = mcItemAlign.BottomRight; hit = true; } if (m_centerRgn.IsVisible(p)) { select = mcItemAlign.Center; hit = true; } if (m_leftCenterRgn.IsVisible(p)) { select = mcItemAlign.LeftCenter; hit = true; } if (m_rightCenterRgn.IsVisible(p)) { select = mcItemAlign.RightCenter; hit = true; } if (m_topCenterRgn.IsVisible(p)) { select = mcItemAlign.TopCenter; hit = true; } if (m_bottomCenterRgn.IsVisible(p)) { select = mcItemAlign.BottomCenter; hit = true; } if ((this.AlignChanged != null) && (hit)) { this.AlignChanged(this, new AlignEventArgs(select)); } }
private void m_alignCtrl_AlignChanged(object sender, AlignEventArgs e) { m_selectedAlign = e.Align; //remove listner m_alignCtrl.AlignChanged -= new AlignEventHandler(m_alignCtrl_AlignChanged); // close the drop-dwon, we are done wfes.CloseDropDown(); }
public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value) { wfes = (IWindowsFormsEditorService) provider.GetService(typeof(IWindowsFormsEditorService)); if((wfes == null) || (context == null)) return null ; m_alignCtrl.Default = (mcItemAlign)value; // add listner for event m_alignCtrl.AlignChanged+=new AlignEventHandler(m_alignCtrl_AlignChanged); m_selectedAlign = (mcItemAlign)value; // show the popup as a drop-down wfes.DropDownControl(m_alignCtrl) ; // return the selection (or the original value if none selected) return m_selectedAlign; }
public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value) { wfes = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if ((wfes == null) || (context == null)) { return(null); } m_alignCtrl.Default = (mcItemAlign)value; // add listner for event m_alignCtrl.AlignChanged += new AlignEventHandler(m_alignCtrl_AlignChanged); m_selectedAlign = (mcItemAlign)value; // show the popup as a drop-down wfes.DropDownControl(m_alignCtrl); // return the selection (or the original value if none selected) return(m_selectedAlign); }
private Rectangle ImageRect(mcItemAlign align) { Rectangle imageRect = new Rectangle(0, 0, m_rect.Width, m_rect.Height); switch (align) { case mcItemAlign.LeftCenter: { imageRect.X = m_rect.X + 2; imageRect.Y = m_rect.Top + ((m_rect.Height / 2) - (m_dayImage.Height / 2)); break; } case mcItemAlign.RightCenter: { imageRect.X = m_rect.Right - 2 - m_dayImage.Width; imageRect.Y = m_rect.Top + ((m_rect.Height / 2) - (m_dayImage.Height / 2)); break; } case mcItemAlign.TopCenter: { imageRect.X = m_rect.X + ((m_rect.Width / 2) - (m_dayImage.Width / 2)); imageRect.Y = m_rect.Y + 2; break; } case mcItemAlign.BottomCenter: { imageRect.X = m_rect.X + ((m_rect.Width / 2) - (m_dayImage.Width / 2)); imageRect.Y = m_rect.Bottom - 2 - m_dayImage.Height; break; } case mcItemAlign.TopLeft: { imageRect.X = m_rect.X + 2; imageRect.Y = m_rect.Y + 2; break; } case mcItemAlign.TopRight: { imageRect.X = m_rect.Right - 2 - m_dayImage.Width; imageRect.Y = m_rect.Y + 2; break; } case mcItemAlign.Center: { imageRect.X = m_rect.X + ((m_rect.Width / 2) - (m_dayImage.Width / 2)); imageRect.Y = m_rect.Top + ((m_rect.Height / 2) - (m_dayImage.Height / 2)); break; } case mcItemAlign.BottomLeft: { imageRect.X = m_rect.X + 2; imageRect.Y = m_rect.Bottom - 2 - m_dayImage.Height; break; } case mcItemAlign.BottomRight: { imageRect.X = m_rect.Right - 2 - m_dayImage.Width; imageRect.Y = m_rect.Bottom - 2 - m_dayImage.Height; break; } } imageRect.Height = m_dayImage.Height; imageRect.Width = m_dayImage.Width; return(imageRect); }
private StringFormat GetStringAlignment(mcItemAlign align) { StringFormat sf = new StringFormat(); switch (align) { case mcItemAlign.LeftCenter: { sf.Alignment = StringAlignment.Near; sf.LineAlignment = StringAlignment.Center; break; } case mcItemAlign.RightCenter: { sf.Alignment = StringAlignment.Far; sf.LineAlignment = StringAlignment.Center; break; } case mcItemAlign.TopCenter: { sf.Alignment = StringAlignment.Center; sf.LineAlignment = StringAlignment.Near; break; } case mcItemAlign.BottomCenter: { sf.Alignment = StringAlignment.Center; sf.LineAlignment = StringAlignment.Far; break; } case mcItemAlign.TopLeft: { sf.Alignment = StringAlignment.Near; sf.LineAlignment = StringAlignment.Near; break; } case mcItemAlign.TopRight: { sf.Alignment = StringAlignment.Far; sf.LineAlignment = StringAlignment.Near; break; } case mcItemAlign.Center: { sf.Alignment = StringAlignment.Center; sf.LineAlignment = StringAlignment.Center; break; } case mcItemAlign.BottomLeft: { sf.Alignment = StringAlignment.Near; sf.LineAlignment = StringAlignment.Far; break; } case mcItemAlign.BottomRight: { sf.Alignment = StringAlignment.Far; sf.LineAlignment = StringAlignment.Far; break; } } return(sf); }
public AlignEventArgs(mcItemAlign align) { this.m_align = align; }
/// <summary> /// Initializes a new instance of the DayClickEventArgs class with default settings /// </summary> public AlignEventArgs() { m_align = mcItemAlign.Center; }
public Month(MonthCalendar calendar) { m_calendar = calendar; m_dateFont = new Font("Microsoft Sans Serif",(float)8.25); m_textFont = new Font("Microsoft Sans Serif",(float)8.25); m_dayInFocus = -1; m_selArea.Clear(); m_formatTrailing = true; m_imageAlign = mcItemAlign.TopLeft; m_dateAlign = mcItemAlign.Center; m_textAlign = mcItemAlign.BottomLeft; m_imageClick = false; // we need 42 (7 * 6) days for display m_days = new Day[42]; for (int i = 0;i<42;i++) { m_days[i] = new Day(); m_days[i].Month = this; m_days[i].Calendar = m_calendar; } m_colors = new MonthColors(this); m_borderStyles = new MonthBorderStyles(this); m_padding = new MonthPadding(this); m_transparency = new TransparencyCollection(this); }
private Rectangle ImageRect(mcItemAlign align) { Rectangle imageRect = new Rectangle(0,0,m_rect.Width,m_rect.Height); switch (align) { case mcItemAlign.LeftCenter: { imageRect.X = m_rect.X + 2; imageRect.Y = m_rect.Top +((m_rect.Height/2) - (m_dayImage.Height/2)); break; } case mcItemAlign.RightCenter: { imageRect.X = m_rect.Right - 2 - m_dayImage.Width; imageRect.Y = m_rect.Top +((m_rect.Height/2) - (m_dayImage.Height/2)); break; } case mcItemAlign.TopCenter: { imageRect.X = m_rect.X +((m_rect.Width/2) - (m_dayImage.Width/2)); imageRect.Y = m_rect.Y + 2; break; } case mcItemAlign.BottomCenter: { imageRect.X = m_rect.X +((m_rect.Width/2) - (m_dayImage.Width/2)); imageRect.Y = m_rect.Bottom -2 - m_dayImage.Height; break; } case mcItemAlign.TopLeft: { imageRect.X = m_rect.X + 2; imageRect.Y = m_rect.Y + 2; break; } case mcItemAlign.TopRight: { imageRect.X = m_rect.Right - 2 - m_dayImage.Width; imageRect.Y = m_rect.Y + 2; break; } case mcItemAlign.Center: { imageRect.X = m_rect.X +((m_rect.Width/2) - (m_dayImage.Width/2)); imageRect.Y = m_rect.Top +((m_rect.Height/2) - (m_dayImage.Height/2)); break; } case mcItemAlign.BottomLeft: { imageRect.X = m_rect.X + 2; imageRect.Y = m_rect.Bottom -2 - m_dayImage.Height; break; } case mcItemAlign.BottomRight: { imageRect.X = m_rect.Right - 2 - m_dayImage.Width; imageRect.Y = m_rect.Bottom -2 - m_dayImage.Height; break; } } imageRect.Height = m_dayImage.Height; imageRect.Width = m_dayImage.Width; return imageRect; }
private StringFormat GetStringAlignment(mcItemAlign align) { StringFormat sf = new StringFormat(); switch (align) { case mcItemAlign.LeftCenter: { sf.Alignment = StringAlignment.Near; sf.LineAlignment = StringAlignment.Center; break; } case mcItemAlign.RightCenter: { sf.Alignment = StringAlignment.Far; sf.LineAlignment = StringAlignment.Center; break; } case mcItemAlign.TopCenter: { sf.Alignment = StringAlignment.Center; sf.LineAlignment = StringAlignment.Near; break; } case mcItemAlign.BottomCenter: { sf.Alignment = StringAlignment.Center; sf.LineAlignment = StringAlignment.Far; break; } case mcItemAlign.TopLeft: { sf.Alignment = StringAlignment.Near; sf.LineAlignment = StringAlignment.Near; break; } case mcItemAlign.TopRight: { sf.Alignment = StringAlignment.Far; sf.LineAlignment = StringAlignment.Near; break; } case mcItemAlign.Center: { sf.Alignment = StringAlignment.Center; sf.LineAlignment = StringAlignment.Center; break; } case mcItemAlign.BottomLeft: { sf.Alignment = StringAlignment.Near; sf.LineAlignment = StringAlignment.Far; break; } case mcItemAlign.BottomRight: { sf.Alignment = StringAlignment.Far; sf.LineAlignment = StringAlignment.Far; break; } } return sf; }
private void m_alignCtrl_AlignChanged(object sender, AlignEventArgs e) { m_selectedAlign = e.Align; //remove listner m_alignCtrl.AlignChanged-=new AlignEventHandler(m_alignCtrl_AlignChanged); // close the drop-dwon, we are done wfes.CloseDropDown(); }