CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2007
    Posts
    110

    Custom Textbox to display combobox with options

    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?

  2. #2
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,284

    Re: Custom Textbox to display combobox with options

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured