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
  1. Home
  2. General Programming
  3. C#
  4. Changing tabbed form over to tiled

Changing tabbed form over to tiled

Scheduled Pinned Locked Moved C#
tutorialcomquestion
4 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.
  • M Offline
    M Offline
    MichCl
    wrote on last edited by
    #1

    I have a tabbed form and I'm trying to switch it over to tiled. It looks like this:

        TabPage newPage = new TabPage(string.Format("{0}:{1}", cb1.cbInfos\[i\].usbHandle, cb1.cbInfos\[i\].boxID));
        InitializeControls(controls\[i\]);
        tabCtrlMain.Size = (controls\[i\].Size);
        tabCtrlMain.Width += 20;
        tabCtrlMain.Height += 100;
        this.Width = tabCtrlMain.Width + 20;
        this.Height = tabCtrlMain.Height + 50;
        newPage.Controls.Add(controls\[i\]);
        tabCtrlMain.TabPages.Add(newPage);
    

    I saw this example, http://sharpertutorials.com/multiple-document-interface-mdi/[^], but this looks different because they are changing where it refers to Run new Form to Run new Mdi example:

    Application.Run(new Form1());
    to
    Application.Run(new MDIParent1());

    but I'm not seeing where I have that sort of thing to switch over. Does anyone have any ideas how to switch over to tiled from tabbed? I'm fine with the contents of my controls[i] containing the correct information. The tabbed forms look fine. We decided to change the look because we think it will work better with this application. Thanks!

    D 1 Reply Last reply
    0
    • M MichCl

      I have a tabbed form and I'm trying to switch it over to tiled. It looks like this:

          TabPage newPage = new TabPage(string.Format("{0}:{1}", cb1.cbInfos\[i\].usbHandle, cb1.cbInfos\[i\].boxID));
          InitializeControls(controls\[i\]);
          tabCtrlMain.Size = (controls\[i\].Size);
          tabCtrlMain.Width += 20;
          tabCtrlMain.Height += 100;
          this.Width = tabCtrlMain.Width + 20;
          this.Height = tabCtrlMain.Height + 50;
          newPage.Controls.Add(controls\[i\]);
          tabCtrlMain.TabPages.Add(newPage);
      

      I saw this example, http://sharpertutorials.com/multiple-document-interface-mdi/[^], but this looks different because they are changing where it refers to Run new Form to Run new Mdi example:

      Application.Run(new Form1());
      to
      Application.Run(new MDIParent1());

      but I'm not seeing where I have that sort of thing to switch over. Does anyone have any ideas how to switch over to tiled from tabbed? I'm fine with the contents of my controls[i] containing the correct information. The tabbed forms look fine. We decided to change the look because we think it will work better with this application. Thanks!

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      There's nothing special here. It's really just:

      Application.Run(new className);

      Instead of calling their startup form the default name of Form1, they changed the name to MDIParent1. Whether of a not a form supports MDI is just a property setting on the form. Just look in the Properties box of your form for "IsMdiContainer". By the way, everyone is moving AWAY from MDI, not towards it. After that, I guess you'll have a bunch of code to rewrite as you apparently won't being TabControl anymore. The only person who can tell you what you have to do is yourself since you're the one who designed the app in its current form.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak

      M 1 Reply Last reply
      0
      • D Dave Kreskowiak

        There's nothing special here. It's really just:

        Application.Run(new className);

        Instead of calling their startup form the default name of Form1, they changed the name to MDIParent1. Whether of a not a form supports MDI is just a property setting on the form. Just look in the Properties box of your form for "IsMdiContainer". By the way, everyone is moving AWAY from MDI, not towards it. After that, I guess you'll have a bunch of code to rewrite as you apparently won't being TabControl anymore. The only person who can tell you what you have to do is yourself since you're the one who designed the app in its current form.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak

        M Offline
        M Offline
        MichCl
        wrote on last edited by
        #3

        Cool. That helped. I'm doing this to add it to my existing form and add the existing control that I was previously showing in the tab:

            Form newForm = new Form();
            InitializeControls(controls\[i\]);
            newForm.Size = (controls\[i\].Size);
            newForm.Width += 20;
            newForm.Height += 100;
            this.Width = newForm.Width + 20;
            this.Height = newForm.Height + 50;
            newForm.Controls.Add(controls\[i\]);
            newForm.ShowDialog();
        

        But it's filling up my entire area. Do you know how to scale the control's contents down to 1/4 the size? I think once I do that, it won't be tough to figure out how to position it (tiled) in the right location in my form with the other 4 controls I'm adding. It didn't let me say newForm.size = controls[i].size/4. (operator / can't be applied to system.drawing.size and int)

        D 1 Reply Last reply
        0
        • M MichCl

          Cool. That helped. I'm doing this to add it to my existing form and add the existing control that I was previously showing in the tab:

              Form newForm = new Form();
              InitializeControls(controls\[i\]);
              newForm.Size = (controls\[i\].Size);
              newForm.Width += 20;
              newForm.Height += 100;
              this.Width = newForm.Width + 20;
              this.Height = newForm.Height + 50;
              newForm.Controls.Add(controls\[i\]);
              newForm.ShowDialog();
          

          But it's filling up my entire area. Do you know how to scale the control's contents down to 1/4 the size? I think once I do that, it won't be tough to figure out how to position it (tiled) in the right location in my form with the other 4 controls I'm adding. It didn't let me say newForm.size = controls[i].size/4. (operator / can't be applied to system.drawing.size and int)

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          Loko at what type the Size property takes, it's an instance of Size. Look at the properties of Size, Height and Width. Sooooo, you just make a new instance of a Size with the new values:

          using System.Drawing;
          
          .
          .
          .
          
          Size newSize = new Size(controls\[i\].Size.Width / 4, controls\[i\].Size.Height / 4);
          controls\[i\].Size = newSize;
          

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak

          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