Is it possible to get the text area of a NumericUpDown control? I\'m looking to get it\'s size so that I can mask it with a panel. I don\'t want the user to be able to edit
If you want do disallow manual editing, you can just set ReadOnly
property to true
.
updown.ReadOnly = true;
If you want to disallow selecting too (I wonder why you need this), you can use reflection. I don't think there's better way, because the field upDownEdit
is internal field of UpDownBase
.
FieldInfo editProp = updown.GetType().GetField("upDownEdit", BindingFlags.Instance | BindingFlags.NonPublic);
TextBox edit = (TextBox)editProp.GetValue(updown);
edit.Enabled = false;