private void ShowPopUp() { Point pt = this.Parent.PointToScreen(new Point(this.Left, this.Bottom + 1)); m_WDatePickerPopUp = new WDatePickerPopUp(this, m_ViewStyle, this.Value); m_WDatePickerPopUp.SelectionChanged += new DateSelectionChangedHandler(this.OnPopUp_SelectionChanged); m_WDatePickerPopUp.Closed += new System.EventHandler(this.OnPopUp_Closed); Rectangle screenRect = System.Windows.Forms.Screen.PrimaryScreen.Bounds; if (screenRect.Bottom < pt.Y + m_WDatePickerPopUp.Height) { pt.Y = pt.Y - m_WDatePickerPopUp.Height - this.Height - 1; } if (screenRect.Right < pt.X + m_WDatePickerPopUp.Width) { pt.X = screenRect.Right - m_WDatePickerPopUp.Width - 2; } m_WDatePickerPopUp.Location = pt; m_WDatePickerPopUp.Show(); m_WDatePickerPopUp.m_Start = true; m_DroppedDown = true; }
private void ShowPopUp() { Point pt = this.Parent.PointToScreen(new Point(this.Left,this.Bottom + 1)); m_WDatePickerPopUp = new WDatePickerPopUp(this,m_ViewStyle,this.Value); m_WDatePickerPopUp.SelectionChanged += new DateSelectionChangedHandler(this.OnPopUp_SelectionChanged); m_WDatePickerPopUp.Closed += new System.EventHandler(this.OnPopUp_Closed); Rectangle screenRect = System.Windows.Forms.Screen.PrimaryScreen.Bounds; if(screenRect.Bottom < pt.Y + m_WDatePickerPopUp.Height){ pt.Y = pt.Y - m_WDatePickerPopUp.Height - this.Height - 1; } if(screenRect.Right < pt.X + m_WDatePickerPopUp.Width){ pt.X = screenRect.Right - m_WDatePickerPopUp.Width - 2; } m_WDatePickerPopUp.Location = pt; User32.ShowWindow(m_WDatePickerPopUp.Handle,4); m_WDatePickerPopUp.m_Start = true; m_DroppedDown = true; }