Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / February 2007

Tip: Looking for answers? Try searching our database.

Combo Like User Control

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jeff Gaines - 07 Feb 2007 19:31 GMT
I am putting together a control which will work like a combo box - except
its drop down will be a Tree View.

When I use the control in a panel on a form I can't resize it to allow for
the drop down part - it is constrained by the size of its parent panel -
yet a combo Box can open up and without any such constraints.

Is there a trick to allowing a control to open up (temporarily) over other
controls? I seem to remember from a while back that this could be achieved
by placing the control on a borderless form, but it seems a lot of work
when all I need is Combo like behaviour.

Signature

Jeff Gaines

Stoitcho Goutsev (100) - 07 Feb 2007 20:37 GMT
Controls are child windows they are clipped by the size of theur parent.
Popup windows are not on the other hand. AFAIK using forms is probably the
only way you can pull this off with WindowsForms.

Signature

Stoitcho Goutsev (100)

>I am putting together a control which will work like a combo box - except
>its drop down will be a Tree View.
[quoted text clipped - 7 lines]
> by placing the control on a borderless form, but it seems a lot of work
> when all I need is Combo like behaviour.
Jeff Gaines - 07 Feb 2007 21:17 GMT
On 07/02/2007 in message <O3NoYfvSHHA.1200@TK2MSFTNGP04.phx.gbl> Stoitcho
Goutsev (100) wrote:

>Controls are child windows they are clipped by the size of theur parent.
>Popup windows are not on the other hand. AFAIK using forms is probably the
>only way you can pull this off with WindowsForms.

Thank you, Stoitcho - at least I understand why now :-)

Signature

Jeff Gaines

Linda Liu [MSFT] - 08 Feb 2007 08:44 GMT
Hi Jeff,

The drop down part of a ComboBox control is a separate window, which
enables the drop down part to open up over other controls.

To implement a custom drop down window, we could use a WinForm, whose
FormBorderStyle property is set to None. But this solution is not very
good, because the form would take the focus and inactivate the main window
form. The functionality of the dropdown would be difficult to manage too.

A better solution is to derive a class from NativeWindow and create a popup
window, similar to a tooltip window, that can be shown using the
SW_SHOWNOACTIVATE setting and ShowWindow function via interoop.  A class
created in this way would mimic the behaviour of the base Win32 controls
and it would be easier to create the desired internal functionality such as
item selection and so-on.

You may visit the following link for more information on how to do it using
NativeWindow.

http://vbaccelerator.com/home/NET/Code/Controls/Popup_Windows/Popup_Windows/
article.asp

I searched the web site ' www.codeproject.com' and also found a smarter
solution of using ToolStripDropDown to implement the drop down window. You
may visit the following link for more information on how to do this.

http://www.codeproject.com/useritems/simplepopup.asp

Hope this helps.
If you have any question, please feel free to let me know.

Sincerely,
Linda Liu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Jeff Gaines - 08 Feb 2007 12:48 GMT
On 08/02/2007 in message <KChG411SHHA.3792@TK2MSFTNGHUB02.phx.gbl> Linda
Liu [MSFT] wrote:

>Hi Jeff,
>
>The drop down part of a ComboBox control is a separate window, which
>enables the drop down part to open up over other controls.

[snipped]

Many thanks, Linda - they are very useful examples :-)
Signature

Jeff Gaines

Linda Liu [MSFT] - 12 Feb 2007 03:11 GMT
Hi Jeff,

Thank you for your prompt response.

How about the your implementing the custom drop down window? If you need
our further assistance, please feel free to let me know.

Thank you for using our MSDN Managed Newsgroup Support Service!

Sincerely,
Linda Liu
Microsoft Online Community Support

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.