Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. How to Scale down controls on a window

How to Scale down controls on a window

Scheduled Pinned Locked Moved C#
helptutorialquestionannouncement
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sumeat
    wrote on last edited by
    #1

    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

    S 1 Reply Last reply
    0
    • S sumeat

      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

      S Offline
      S Offline
      STW
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups