Click to See Complete Forum and Search --> : Custom Textbox to display combobox with options


jshultz
September 3rd, 2008, 12:31 PM
Using .Net 2.0

What I am trying to do is create a custom textbox, that is inheriting from a textbox I have already created, that will display a combobox outside of the textbox client area. Think of it kind of like when you are in the designer, you select a text box and you get that little arrow above the text box which will then display the Textbox Tasks. I would like to do something similar, in run time, when the user enters the text box. The purpose is to display a list of measurement options (Inch, MM, Micron, Tenths) so the user can choose the entering mode.

I am having trouble with this because it is not possible to draw outside the client area (other than a border really). I can't figure out a way to display a panel next to the text box when the text box gains focus.

I was hoping to be able to just show/hide a panel with a combobox on it, but that isn't seeming likely. I was also trying to stay away from a usercontrol with a combobox on it in order to prevent the extra padding that would be there when the combobox is hidden (in most places we don't have extra space for that padding).

Any ideas?

HanneSThEGreaT
September 5th, 2008, 01:20 AM
By the looks of it, I think that it would be best to create a usercontrol. This usercontrol will only be the "options" part, and your textbox will be separate. This will not cause any padding as such.

Just my 2 cents