Ejemplo n.º 1
0
        /// <summary>
        /// Opens this instance.
        /// </summary>
        public void Open()
        {
            if (OnOpening != null)
            {
                SquidEventArgs args = new SquidEventArgs();
                OnOpening(this, args);
                if (args.Cancel)
                {
                    return;
                }
            }

            if (HotDrop && Dropdown.Controls.Count == 0)
            {
                return;
            }

            Dropdown.Owner = Parent;

            switch (Align)
            {
            case Alignment.BottomLeft:
                Dropdown.Position = Location + new Point(0, Size.y);
                break;

            case Alignment.TopRight:
                Dropdown.Position = Location + new Point(Size.x, 0);
                break;

            case Alignment.TopLeft:
                Dropdown.Position = Location - new Point(Dropdown.Size.x, 0);
                break;
            }

            Desktop.ShowDropdown(Dropdown, true);
            IsOpen = true;

            if (OnOpened != null)
            {
                OnOpened(this, null);
            }
        }
Ejemplo n.º 2
0
        public void Open()
        {
            if (OnOpening != null)
            {
                SquidEventArgs args = new SquidEventArgs();
                OnOpening(this, args);
                if (args.Cancel)
                {
                    return;
                }
            }

            if (!WasOpenOnce)
            {
                if (DropdownAutoSize)
                {
                    Dropdown.Size = new Point(Size.x, DropdownSize.y);
                }
                else
                {
                    Dropdown.Size = new Point(DropdownSize.x, DropdownSize.y);
                }

                WasOpenOnce = true;
            }

            Dropdown.Position = Location + new Point(0, Size.y);

            Desktop.ShowDropdown(Dropdown, false);
            IsOpen = true;

            if (OnOpened != null)
            {
                OnOpened(this, null);
            }
        }