How to Scale down controls on a window
-
Hi, I have a client window (in a MDI app) with lot of controls - listboxes, buttons, pictureboxes, etc - on it. I want to show a scaled-down version of the window i.e. show a window 1/8th size of the original window with all the controls on it. Is there a way to scale down the controls? Something like: Form newForm = new Form(); newForm.size = OriginalForm.size/8; for(i = 0; i < controlsOnOriginalForm; i++) { // Get control from original form // create same control, size it and put on the new form } Any suggestions / help would be appreciated. Thanks, Suhas
-
Hi, I have a client window (in a MDI app) with lot of controls - listboxes, buttons, pictureboxes, etc - on it. I want to show a scaled-down version of the window i.e. show a window 1/8th size of the original window with all the controls on it. Is there a way to scale down the controls? Something like: Form newForm = new Form(); newForm.size = OriginalForm.size/8; for(i = 0; i < controlsOnOriginalForm; i++) { // Get control from original form // create same control, size it and put on the new form } Any suggestions / help would be appreciated. Thanks, Suhas
I don't think that there exists a "Scale" Methode for this problem. But I see that your code above is the solution for your problem. You just have to iterate through the Controls, resize them and set the right position. Perhaps you'll find a good common method for this. Maybe the Anchor property of a Control helps you. Perhaps this may help too: Array a=new ArrayList(); this.form.Controls.CopyTo(a,0) //Copies the Controls to an array Form f=new Form(); foreach(object o in a) { Control ctrl=(Control)o; //get the control ctrl=this.RecalcControl(ctrl) //Common Method to fix size and location f.Controls.Add(ctrl); } void RecalcControl(Control ctrl) { ctrl.Size=.. ctrl.Location=.. return ctrl; } Your problem will be a good education for C# Good luck Stefan W.