Пример #1
0
        public CheckComboBox()
        {
            this.DrawMode = DrawMode.OwnerDrawFixed;//只有设置这个属性为OwnerDrawFixed才可能让重画起作用

            lst.Width = ListWidth == 0 ? this.Width : ListWidth;
            //lst.Height = ListHeight == 0 ? 300 : ListHeight;
            lst.CheckBoxes      = true;
            lst.ShowLines       = false;
            lst.ShowPlusMinus   = false;
            lst.ShowRootLines   = false;
            lst.KeyUp          += new KeyEventHandler(lst_KeyUp);
            lst.AfterCheck     += new TreeViewEventHandler(lst_AfterCheck);
            this.DropDownHeight = 1;
            frmhost             = new PopupForm(lst);
            //frmhost.Closed += new ToolStripDropDownClosedEventHandler(frmhost_Closed);
            //frmhost.Opened += new EventHandler(frmhost_Opened);
        }
Пример #2
0
 private void SetOwnerItem(Control control)
 {
     if (control == null)
     {
         return;
     }
     if (control is PopupForm)
     {
         PopupForm popupControl = control as PopupForm;
         ownerPopup            = popupControl;
         ownerPopup.childPopup = this;
         OwnerItem             = popupControl.Items[0];
         return;
     }
     if (control.Parent != null)
     {
         SetOwnerItem(control.Parent);
     }
 }