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. resizable panel

resizable panel

Scheduled Pinned Locked Moved C#
6 Posts 3 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.
  • C Offline
    C Offline
    cmarmr
    wrote on last edited by
    #1

    is there a way i can add controls to a panel and make the panel resizable chad

    P 1 Reply Last reply
    0
    • C cmarmr

      is there a way i can add controls to a panel and make the panel resizable chad

      P Offline
      P Offline
      Peter Nirschl
      wrote on last edited by
      #2

      Of course you can add controls to your panel. Example: this.control1.Parent = this.panel1; (Control1's parent is set to panel1) To resize your panel just set the Size property. Example: this.panel1.Size = new Size([width],[heigth]); or set the panel's Height and Width property. Good luck! ;)

      C 1 Reply Last reply
      0
      • P Peter Nirschl

        Of course you can add controls to your panel. Example: this.control1.Parent = this.panel1; (Control1's parent is set to panel1) To resize your panel just set the Size property. Example: this.panel1.Size = new Size([width],[heigth]); or set the panel's Height and Width property. Good luck! ;)

        C Offline
        C Offline
        cmarmr
        wrote on last edited by
        #3

        will i be able to resize the panel at runtime chad

        H 1 Reply Last reply
        0
        • C cmarmr

          will i be able to resize the panel at runtime chad

          H Offline
          H Offline
          Heath Stewart
          wrote on last edited by
          #4

          Yes. That code he posted gets compiled and executed at runtime. You can change it's size and position all you want in response to events like mouse movement or clicks, etc.

          Microsoft MVP, Visual C# My Articles

          C 1 Reply Last reply
          0
          • H Heath Stewart

            Yes. That code he posted gets compiled and executed at runtime. You can change it's size and position all you want in response to events like mouse movement or clicks, etc.

            Microsoft MVP, Visual C# My Articles

            C Offline
            C Offline
            cmarmr
            wrote on last edited by
            #5

            ok you must forgive me i'm new to csharp i changes the size of my panenl how do i make it where my users can change it when there useing my form because right now they can't change the size of it when i compile it chad

            H 1 Reply Last reply
            0
            • C cmarmr

              ok you must forgive me i'm new to csharp i changes the size of my panenl how do i make it where my users can change it when there useing my form because right now they can't change the size of it when i compile it chad

              H Offline
              H Offline
              Heath Stewart
              wrote on last edited by
              #6

              Of course they can't change it unless you provide a way. It's compiled using a certain size and position. If you want the Panel to resize in relation to its container, look at the Anchor and Dock properties. With Anchor, if you anchor the control to opposite sides, it will be resized in relation the margin between its borders and that of the corresponding borders of the container control. If you want your users to be able to resize it like you can in the designer, you'll have to provide a mechanism to do so, like handling the MouseDown to set a flag, the MouseMove event to resize or move the ocntrol if that flag is set, and the MouseUp event to reset the flag. When you compile an application, it's runs according to how you program it. Application don't general allow for design-like changes to it. Part of the reason you compile an application is that people can't change it (easily).

              Microsoft MVP, Visual C# My Articles

              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