Full-Screen Forms question.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

How can we run the app on full-screen. I mean all the controls such as,
text boxes, data grids on the form would also be resized or re-located
automatically when we press maximize button on the top right corner
of the form.

Currently, when I maximize the form.. controls on the form are not
relocating.
How can we do this..

Cheers,

Naveen.
 
You have to figure out how you want them to relocate, and execute code to
change their position and/or size. (This may require an appreciable amount
of thought.) I think the event you want to handle is called OnResize.
 
Naveen said:
Hi,

How can we run the app on full-screen. I mean all the controls such as,
text boxes, data grids on the form would also be resized or re-located
automatically when we press maximize button on the top right corner
of the form.

Currently, when I maximize the form.. controls on the form are not
relocating.
How can we do this..

Cheers,

Naveen.
check out the dock and anchor properties on the controls.
JB
 
i think you must to listen to john b....

there are 2 ways, the simple or the complicated...

component one, they have a component, that calls elastic (if i remember
well) its like a table on html, and you can put % width and hights... its
really good one...

or put on your application a cuple of panels, and use the dock property, and
in the panels put your controls with dock property set to full...


salute!
 
Rothariger said:
i think you must to listen to john b....

there are 2 ways, the simple or the complicated...

component one, they have a component, that calls elastic (if i remember
well) its like a table on html, and you can put % width and hights... its
really good one...

Is elastic a .net 2.0 addition? I can't find it in 1.1. In my case I had 2
group boxes with a vertical row of buttons between them. I was able to
automatically resize the contents of the gbs, but had to resort to using
OnResize to move the boxes and button stack the way I wanted (buttons
centered horizontally and fixed in size with both GBs scaling to fit the
available space on thier side)
 
..NET 2.0 Windows Forms comes with (I believe) layout managers like
those in Java, to allow more control over form layout. Until then, use
Panels-within-Panels, and the Anchor and Dock properties to get the
effect you want.
 
Bruce Wood said:
..NET 2.0 Windows Forms comes with (I believe) layout managers like
those in Java, to allow more control over form layout. Until then, use
Panels-within-Panels, and the Anchor and Dock properties to get the
effect you want.

Will doing it that way give me anything that stuffing collections of
controls I want to move together inside of groupboxes won't? I wasted
several hours trying to do what I wanted that way.
 
Using the current system of panels-within-panels, anchoring, and
docking, you can achieve any effect except for the _proportional_
resizing of things (which, unfortunately, is often what you want).

For example, if you have two halves to your form, and you want the
controls on one side to stay a fixed size as you resize the form and
the controls on the other to stretch with the resizing, you can do
this. If you want the two sides to both resize with the form so that
they always take up half of the form each, then you can't (without
writing custom code).

The layout manager system in .NET 2.0 will solve this problem, allowing
you to design layouts to your taste.
 
Bruce Wood said:
Using the current system of panels-within-panels, anchoring, and
docking, you can achieve any effect except for the _proportional_
resizing of things (which, unfortunately, is often what you want).

For example, if you have two halves to your form, and you want the
controls on one side to stay a fixed size as you resize the form and
the controls on the other to stretch with the resizing, you can do
this. If you want the two sides to both resize with the form so that
they always take up half of the form each, then you can't (without
writing custom code).

The layout manager system in .NET 2.0 will solve this problem, allowing
you to design layouts to your taste.

Cool. The proportional resizing was exactly what I needed to do. At least
now I know I didn't waste my time on something I could've done easier.
 
I've still managed to do this with relatively little pain.

I just put all of the controls into two panels, then overrode the
OnResize method for the form and resized the two panels to keep them
proportional. Inside those two panels I did all of the other control
resizing using anchoring and docking, and panels-within-panels.

I try to do as much work as I can using the standard .NET features,
then write that little bit of code to go the last mile.

All of this will be much easier with .NET 2.0!
 
Bruce Wood said:
I've still managed to do this with relatively little pain.

I just put all of the controls into two panels, then overrode the
OnResize method for the form and resized the two panels to keep them
proportional. Inside those two panels I did all of the other control
resizing using anchoring and docking, and panels-within-panels.

I did most of my work similarly using groupboxes to hold most of the
controls. I didn't think to use a panel to work with the row of buttons down
the center my boss didn't want boxed. One of the things that cost me the
most time with the onresize event was working out magic numbers for things
like border and titlebar thicknesses to compute the usable dimensions of the
dialog. The second was that if the dialog was sized small enough the buttons
needed moved closer together to all fit, but I couldn't leave them packed up
in the top part if the dialog was normal sized. A layout manager with
autospacing would've been a real lifesaver there.
 
Did you check out the ClientSize property of the dialog? This should
give you the usable space. The only hitch is at start-up, in the form's
constructor, ClientSize hasn't yet taken into account the menu bar. It
first starts telling the truth in the OnLoad event, I think.

After that, it gives you the usable space in the Form.
 
Dan said:
Is elastic a .net 2.0 addition? I can't find it in 1.1.

Elastic is a third-party control from a company called ComponentOne.
(I've used the ActiveX version, and I assume there is a .Net version
as well.) http://componentone.com/

This is NOT an endorsement -- in fact, if control position/size is
the only thing you want from them, I would recommend NOT using
ComponentOne, even if the .Net 2.0 stuff doesn't do what you want.
Control repositioning just isn't that hard to do manually, with a
little thought.

(On the other hand, their grid is a LOT better than anything else in
ActiveX land; I don't have any experience with .Net DataGrid yet, but
I suspect that Component One's FlexGrid still blows it away.)
 
Bruce Wood said:
Did you check out the ClientSize property of the dialog? This should
give you the usable space. The only hitch is at start-up, in the form's
constructor, ClientSize hasn't yet taken into account the menu bar. It
first starts telling the truth in the OnLoad event, I think.

I didn't know it existed. I'll keep it in mind if/when something changes
that makes me need to revist the code.
 
Back
Top