Exemplo n.º 1
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="item">下拉框弹出窗体基类</param>
        public UIDropDown(UIDropDownItem item)
        {
            Item = item ?? throw new ArgumentNullException(nameof(item));
            Item.ValueChanged += DoValueChanged;

            InitializeComponent();
            AutoSize       = false;
            DoubleBuffered = true;
            //ResizeRedraw = true;
            ToolStripControlHost _host = new ToolStripControlHost(item);

            Padding          = Margin = _host.Padding = _host.Margin = Padding.Empty;
            item.MinimumSize = item.Size;
            item.MaximumSize = item.Size;
            Size             = item.Size;
            TabStop          = item.TabStop = true;
            item.Location    = Point.Empty;
            Items.Add(_host);
            item.Disposed += (sender, e) =>
            {
                item = null;
                Dispose(true);
            };

            item.RegionChanged += (sender, e) => UpdateRegion();
            UpdateRegion();
        }
Exemplo n.º 2
0
 public UIToolStripDropDown(UIDropDownItem item)
 {
     itemForm = new UIDropDown(item);
     itemForm.ValueChanged   += ItemForm_ValueChanged;
     itemForm.VisibleChanged += ItemForm_VisibleChanged;
     itemForm.Closed         += ItemForm_Closed;
     itemForm.Opened         += ItemForm_Opened;
     itemForm.Opening        += ItemForm_Opening;
 }
Exemplo n.º 3
0
        /// <summary>
        /// 析构函数
        /// </summary>
        /// <param name="disposing">disposing</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                components?.Dispose();

                if (Item != null)
                {
                    UIDropDownItem _content = Item;
                    Item = null;
                    _content.Dispose();
                }
            }

            base.Dispose(disposing);
        }