if (index == owner.SelectedIndex) {
if (owner.textbox_ctrl == null)
owner.Refresh ();
- else
- owner.textbox_ctrl.SelectedText = value.ToString ();
+ else {
+ owner.textbox_ctrl.Text = value.ToString ();
+ owner.textbox_ctrl.SelectAll ();
+ }
}
}
}
return owner.Focused;
}
}
-
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing ) {
+ // Prevents corruption of combobox text by disposed object
+ owner.EnabledChanged -= OwnerEnabledChangedHandler;
+ owner.LostFocus -= OwnerLostFocusHandler;
+ }
+ base.Dispose(disposing);
+ }
+
internal override bool ActivateOnShow { get { return false; } }
}
vscrollbar_ctrl.Value = hli;
}
}
-
- Size = new Size (width, height);
- textarea_drawable = ClientRectangle;
- textarea_drawable.Width = width;
- textarea_drawable.Height = height;
-
+
+ var borderWidth = Hwnd.GetBorderWidth (CreateParams);
+ var borderAdjustment = dropdown_style == ComboBoxStyle.Simple ? new Size (0, 0) :
+ new Size (borderWidth.top + borderWidth.bottom, borderWidth.left + borderWidth.right);
+ Size = new Size (width, height + borderAdjustment.Height);
+ textarea_drawable = new Rectangle (ClientRectangle.Location,
+ new Size (width - borderAdjustment.Width, height));
+
if (vscrollbar_ctrl != null && show_scrollbar)
textarea_drawable.Width -= vscrollbar_ctrl.Width;
HighlightedIndex = owner.SelectedIndex;
CalcListBoxArea ();
+ // If the listbox would extend below the screen, move it above the textbox.
+ Rectangle scrn_rect = Screen.FromControl (owner).Bounds;
+ if (this.Location.Y + this.Height >= scrn_rect.Bottom)
+ this.Location = new Point (this.Location.X, this.Location.Y - (this.Height + owner.TextArea.Height));
Show ();
Refresh ();