Example #1
0
        public virtual void ShowDropdown(DropdownContainerControl <T> owner)
        {
            if (owner != null)
            {
                m_owner = owner;
            }

            Show();
            m_hook.SetHook(true);
        }
Example #2
0
        public DropdownContainer(DropdownContainerControl <T> owner)
        {
            m_owner = owner;

            // this is for the window to show at correct location first time it is opened
            WinUtil.SetWindowPos(Handle, IntPtr.Zero, 0, 0, 0, 0, WinUtil.SWP_NOACTIVATE);

            FormBorderStyle = FormBorderStyle.None;
            SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);

            SetTopLevel(true);
            ShowInTaskbar = false;
            Hide();


            Rectangle r = WindowRectangle;

            r.Inflate(-2, -2);
            r.Y--;
            m_cancelButton          = new Button();
            m_cancelButton.Text     = "Cancel";
            m_cancelButton.Size     = new Size(60, m_buttonAreaHeight - 2);
            m_cancelButton.Location = new Point(r.Right - m_cancelButton.Size.Width, r.Bottom - m_cancelButton.Height);
            m_cancelButton.Anchor   = AnchorStyles.Bottom | AnchorStyles.Right;
            m_cancelButton.Click   += new EventHandler(OnCancelClick);
            Controls.Add(m_cancelButton);

            m_acceptButton          = new Button();
            m_acceptButton.Text     = "Accept";
            m_acceptButton.Size     = new Size(60, m_buttonAreaHeight - 2);
            m_acceptButton.Location = new Point(m_cancelButton.Left - m_acceptButton.Size.Width - 1, r.Bottom - m_acceptButton.Height);
            m_acceptButton.Anchor   = AnchorStyles.Bottom | AnchorStyles.Right;
            m_acceptButton.Click   += new EventHandler(OnAcceptClick);
            Controls.Add(m_acceptButton);

            m_hook.OnKeyDown += new Hook.KeyboardDelegate(OnHookKeyDown);
        }