//===================================================================== /// <summary> /// This is used to initialize the drop-down styles and data source /// </summary> private void InitDropDown() { // Create and initialize the drop-down control if (owner.DropDownControl != null) { ConstructorInfo ctor = owner.DropDownControl.GetConstructor(Type.EmptyTypes); ddControl = (DropDownControl)ctor.Invoke(null); ddControl.Location = new Point(0, 0); ddControl.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right; ddControl.AutoScroll = true; ddControl.Font = owner.DropDownFont; ddControl.ComboBox = owner; if (ddControl.BackColor == SystemColors.Control) { ddControl.BackColor = owner.DropDownBackColor; } ddControl.Height = this.Height; ddControl.Width = this.Width; this.Controls.Add(ddControl); // Tell everyone it has been created owner.OnDropDownControlCreated(ddControl); // Give the drop-down control a chance to perform any necessary initialization ddControl.InitializeDropDown(); // Tell everyone it has been initialized owner.OnDropDownControlInitialized(ddControl); } hasInitialized = true; }
//===================================================================== /// <summary> /// This is used to initialize the drop-down styles and data source /// </summary> private void InitDropDown() { // Create and initialize the drop-down control if (owner.DropDownControl != null) { ConstructorInfo ctor = owner.DropDownControl.GetConstructor(Type.EmptyTypes); ddControl = (DropDownControl)ctor.Invoke(null); ddControl.Location = new Point(0, 0); ddControl.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right; ddControl.AutoScroll = true; ddControl.Font = owner.DropDownFont; ddControl.ComboBox = owner; if (ddControl.BackColor == SystemColors.Control) { ddControl.BackColor = owner.DropDownBackColor; } // Add 16 pixels so that we can draw the sizing grip this.Height = ddControl.Height + 16; this.Width = ddControl.Width + 2; this.MinimumSize = ddControl.MinimumSize; this.Controls.Add(ddControl); // Tell everyone it has been created owner.OnDropDownControlCreated(ddControl); // Give the drop-down control a chance to perform any necessary initialization ddControl.InitializeDropDown(); // Tell everyone it has been initialized owner.OnDropDownControlInitialized(ddControl); } // Size the drop-down to the owner's width if it is wider if (this.Width < owner.Width) { this.Width = owner.Width; } hasInitialized = true; }