/// <summary> /// Show the <c>PSImgPanel</c> as a popup with its origin /// at the specified X,Y coordinates (relative to its parent) /// </summary> /// <param name="x">Left</param> /// <param name="y">Top</param> /// <param name="placement">Specifies relative meaning of X/Y coordinates</param> /// <param name="focusMe">Control to receive the focus when the /// popup is complete (or <see langword="null"/>)</param> /// <returns> /// The image index selected, or -1 if canceled /// </returns> public int Popup(int x, int y, ImagePanelPlacement placement,Control focusMe) { if (Visible) { return -1 ; } return DoPopup(x,y,placement,focusMe) ; }
/// <summary> /// Show the <c>PSImgPanel</c> as a popup with its origin /// at the specified X,Y coordinates (relative to its parent) /// with dimensions suggested by the <see cref="PanelSizeHints"/> /// </summary> /// <param name="x">Left</param> /// <param name="y">Top</param> /// <param name="placement">Relative meaning of X/Y coordinates</param> /// <param name="panelSizeHint">Hint about panel layout</param> /// <param name="focusMe">Control to receive the focus when the /// popup is complete (or <see langword="null"/>)</param> /// <returns> /// The image index selected, or -1 if canceled /// </returns> public int Popup(int x,int y,ImagePanelPlacement placement,Control focusMe,PanelSizeHints panelSizeHint) { if (Visible) { return -1 ; } Dimensions = CalculateBestDimensions(imageCount,panelSizeHint) ; return DoPopup(x,y,placement,focusMe) ; }
/// <summary> /// Popup the <c>PSImgPanel</c> at the specified coordinates /// </summary> /// <param name="x">The X origin</param> /// <param name="y">The Y origin</param> /// <param name="placement">Specifies meaning of X/Y coordinates</param> /// <param name="focusMe">The control to receive focus when the popup completes</param> /// <returns> /// The index of the image selected, or -1 if canceled /// </returns> public int DoPopup(int x,int y,ImagePanelPlacement placement,Control focusMe) { Size client = CalculateBestClientSize() ; Rectangle popupRect ; switch(placement) { case ImagePanelPlacement.BottomLeft: popupRect = new Rectangle(x,y-client.Height,client.Width,client.Height) ; break ; case ImagePanelPlacement.BottomRight: popupRect = new Rectangle(x-client.Width,y-client.Height,client.Width,client.Height) ; break ; case ImagePanelPlacement.TopRight: popupRect = new Rectangle(x-client.Width,y,client.Width,client.Height) ; break ; case ImagePanelPlacement.TopLeft: default: popupRect = new Rectangle(x,y,client.Width,client.Height) ; break ; } return DoPopup(popupRect,focusMe) ; }