Ejemplo n.º 1
0
        /// <summary>
        /// Constructor that creates a new popup form with specified content, owner, and location.
        /// </summary>
        /// <param name="content">The content to show in the popup</param>
        /// <param name="popupOwner">The control that owns the popup.</param>
        /// <param name="location">The location of the popup, in screen coordinates.</param>
        public PopupForm(Control content, Control popupOwner, Point location)
        {
            InitializeComponent();

            _popupOwner = popupOwner;
            _location   = location;

            _helper              = new PopupWindowHelper();
            _helper.PopupClosed += delegate
            {
                if (_popupClosed != null)
                {
                    _popupClosed(this, EventArgs.Empty);
                }
            };
            _helper.PopupCancel += delegate(object sender, PopupCancelEventArgs e)
            {
                if (_popupCancelled != null)
                {
                    CancelEventArgs c = new CancelEventArgs(e.Cancel);
                    _popupCancelled(this, c);
                    e.Cancel = c.Cancel;
                }
            };

            // size the content appropriately, and size this form to match the content
            content.MinimumSize = content.Size;
            content.Dock        = DockStyle.Fill;
            this.ClientSize     = content.Size;

            // add content to form
            this.Controls.Add(content);
        }
        /// <summary>
        /// Shows the active band in a popup when the bar is collapsed
        /// </summary>
        public void ShowCollapsedBandPopup()
        {
            if (Bar.ActiveBand != null)
            {
                popup          = new NaviBandPopup();
                popup.Content  = Bar.ActiveBand.ClientArea;
                popup.Renderer = renderer;

                popupHelper = new PopupWindowHelper();
                Form parent = Bar.FindForm();
                popupHelper.PopupClosed += new PopupClosedEventHandler(popupHelper_PopupClosed);

                popupHelper.AssignHandle(parent.Handle);
                popup.Resizable     = true;
                popup.ShowInTaskbar = false;
                popup.Height        = Bar.PopupHeight;
                popup.Width         = orgWidth;
                popup.RightToLeft   = Bar.RightToLeft;
                popup.MinimumSize   = new Size(Bar.PopupMinWidth, 30);

                if (Bar.RightToLeft == RightToLeft.Yes)
                {
                    popupHelper.ShowPopup(parent, popup, Bar.PointToScreen(new Point(0 - orgWidth, Bar.HeaderHeight)));
                }
                else
                {
                    popupHelper.ShowPopup(parent, popup, Bar.PointToScreen(new Point(Bar.Width, Bar.HeaderHeight)));
                }
            }
        }
Ejemplo n.º 3
0
 public Form1()
 {
     //
     // Required for Windows Form Designer support
     //
     InitializeComponent();
     filePop     = new FilePopup();
     winPop      = new WindowsPopup();
     popupHelper = new PopupWindowHelper();
 }