By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,678 Members | 1,146 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,678 IT Pros & Developers. It's quick & easy.

Relocate control after Maximize form

P: 36
hi
How can we run the app on full-screen. I mean all the controls such as,
pictureboxe, button on the form would also be re-located when run application at maximize window state

Currently, when I maximize the form.. controls on the form are not
relocating.
How can we do this..
Nov 12 '08 #1
Share this Question
Share on Google+
6 Replies


Plater
Expert 5K+
P: 7,872
attach a handler to one(or more?) of the window size events (resize, resizebegin, resizeend, sizechanged) and recompute where the controls sit
Nov 12 '08 #2

P: 36
Thanx alot Mr. Plater

is it posible to solve this problem by using .Net function

this.ScaleControl(new SizeF(15, 30), BoundsSpecified.All);
If yes please explain how can I do that.
Nov 15 '08 #3

joedeene
100+
P: 583
For your situation when the form is maximized, do you want the controls to get bigger also? If not, you can just use the Control.Dock Property.

joedeene
Nov 15 '08 #4

P: 36
The problem was solved by using Scale function for each control with Maximize Scale Factor which calculate by divide size of form in case of maximize over size of form in case of normal .

Question is this solution need to add about a pixel or 2 for location of control,

How to can I make it accurate (without adding pixel)?


Second Question How to prevent editing of Textbox?


Last Question , when I set text at Textbox and minimize form then return to it again all text at textbox was clear. Do you know why something like this happen ?

Thanks for advance.
Nov 16 '08 #5

balabaster
Expert 100+
P: 797
You know, you'd think someone would have developed something that would do this by now but I've yet to come across anything useful.

I tend to use a combination of sizable panels, dockable panels and basic math to complete this task. I create a "RenderControl" method that places and sizes my controls according to the form size and then in my load and resize event handlers I call my RenderControl method.
Nov 17 '08 #6

Plater
Expert 5K+
P: 7,872
To bala: I believe WPF or whatever their latest shebang is does it, I know I had a heck of time placing controls with it.

As for preventing textbox editing, set the ReadOnly property to true.
As to why the contents are getting lost, I would say it is something to do with how you handle your resizing.
Nov 17 '08 #7

Post your reply

Sign in to post your reply or Sign up for a free account.