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. How to change the height property of panel dynamically

How to change the height property of panel dynamically

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

    i have placed a data grid inside a panel if the data grid have the record the panel will expand and if the data grid don't have a data then the height of the panel will be zero. how i change a height property of a Panel according to the click of the user how to set the height property and scroll property at run time

    KnightGuy

    L 1 Reply Last reply
    0
    • M mharoonkhan

      i have placed a data grid inside a panel if the data grid have the record the panel will expand and if the data grid don't have a data then the height of the panel will be zero. how i change a height property of a Panel according to the click of the user how to set the height property and scroll property at run time

      KnightGuy

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      From what I understand you are trying to do, you are trying to set the size of your panel to be equal to that of the contents inside of it? You can loop for that int i = 0; int max = panel1.controls.items.count -1; panel1.height = 0; while i <= max { panel1.size += panel1.controls.items.i.height; i++; } 'edit you can suspend your layout so you don't see it resize

      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