How do I make a GUI that behaves like this?

Posted by Karl Knechtel on Stack Overflow See other posts from Stack Overflow or by Karl Knechtel
Published on 2010-12-31T04:28:44Z Indexed on 2010/12/31 4:54 UTC
Read the original article Hit count: 212

Filed under:
|
|
|
|

This is difficult to explain without illustration, so - behold, an illustration, cobbled together from screenshots of a few hello-world examples and a lot of Paint work:

GUI mockup

I have started out using Windows Forms on .NET (via IronPython, but that shouldn't be important), and haven't been able to figure out very much. GUI libraries in general are very intimidating, simply because every class has so many possible attributes. Documentation is good at explaining what everything does, but not so good at helping you figure out what you need.

I will be assembling the GUI dynamically, but I'm not expecting that to be the hard part. The sticking points for me right now are:

  • How do I get text labels to size themselves automatically to the width of the contained text (so that the text doesn't clip, and I also don't reserve unnecessary space for them when resizing the window)?

  • How do I make the vertical scrollbar always appear? Setting the VScroll property (why is this protected when AutoScroll is public, BTW?) doesn't seem to do anything.

  • How come the horizontal scrollbar is not added by AutoScroll when contents are laid out vertically (via Dock = DockStyle.Top)? I can use a minimum size for panels to prevent the label and corresponding control from overlapping when the window is shrunk horizontally, but then the scrollbar doesn't appear and the control is inaccessible.

  • How can I put limits on window resizing (e.g. set a minimum width) without disabling it completely? (Just set minimum/maximum sizes for the Form?) Related to that, is there any way to set minimum/maximum widths or heights without setting a minimum/maximum size (i.e. can I constrain the size in only one dimension)?

  • Is there a built-in control suitable for hex editing or am I going to have to build something myself?

... And should I be using something else (perhaps something more capable?) I've heard WPF mentioned, but I understand that this involves XML and I really want to build a GUI from XML - I already have data in an object graph, and doing some kind of weird XML pseudo-serialization (in Python, no less!) in order to create a GUI seems incredibly roundabout.

© Stack Overflow or respective owner

Related posts about winforms

Related posts about gui