WinForms, how to best pop up a user control on a form
-
Hello, for my project I'm dealing with a table layout with a bunch of images. When I click one of these images (left-click, that's a requirement), I would like to pop up a control, basically a listbox with some choices. How should I best go about this? My - probably poor - choice so far is to display a form on top of the table layout form, that suits the purpose but seems not like the _right_ solution. Has anyone some inspiration for me, how I could pop some control up on a form surface which already has a layout to it? Thanks for the inspiration, Morten
-
Hello, for my project I'm dealing with a table layout with a bunch of images. When I click one of these images (left-click, that's a requirement), I would like to pop up a control, basically a listbox with some choices. How should I best go about this? My - probably poor - choice so far is to display a form on top of the table layout form, that suits the purpose but seems not like the _right_ solution. Has anyone some inspiration for me, how I could pop some control up on a form surface which already has a layout to it? Thanks for the inspiration, Morten
harleydk wrote:
choice so far is to display a form on top of the table layout form, that suits the purpose but seems not like the _right_ solution
It is about the only solution, that I know of, unless you want to create some kind of table class that pops the listbox up, and then you are still having to use a form control.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
-
Hello, for my project I'm dealing with a table layout with a bunch of images. When I click one of these images (left-click, that's a requirement), I would like to pop up a control, basically a listbox with some choices. How should I best go about this? My - probably poor - choice so far is to display a form on top of the table layout form, that suits the purpose but seems not like the _right_ solution. Has anyone some inspiration for me, how I could pop some control up on a form surface which already has a layout to it? Thanks for the inspiration, Morten
-
Hello, for my project I'm dealing with a table layout with a bunch of images. When I click one of these images (left-click, that's a requirement), I would like to pop up a control, basically a listbox with some choices. How should I best go about this? My - probably poor - choice so far is to display a form on top of the table layout form, that suits the purpose but seems not like the _right_ solution. Has anyone some inspiration for me, how I could pop some control up on a form surface which already has a layout to it? Thanks for the inspiration, Morten
As Jordanwb suggested but you can have an invisible control and just move it and make it visible when required (may be better than creating and disposing of the control repeatedly). Deciding when to make it invisible after the user is finished will be the issue I would think. Mouse location is easy to trap on the click event.
Never underestimate the power of human stupidity RAH