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. Anchors, MinSize, and AutoScroll

Anchors, MinSize, and AutoScroll

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

    I have a situation where I have a panel inside another panel (we'll call them innerPanel and outerPanel). outerPanel is anchored on all four sides so it expands and contracts with the window. outerPanel also has the AutoScroll property set to true. If I put innerPanel inside outerPanel and anchor it left, right, and top then when I make the window very short scroll bars appear on outerPanel. However, innerPanel's height will not expand when I expand the window. This is what I expect to happen. If I set the anchors on innerPanel to all four sides it expands and contracts with the window. However, sometimes innerPanel shrinks too small to see it's contents. This is the behavior I expect. Now, if I set a minimum width on innerPanel and anchor to all four sides it will expand with the window like I want, but when I reach that minimum size innerPanel just gets cut off, the scroll bars never appear. This is absolutely not what I expect. Am I doing something wrong? I want innerPanel to expand freely in all directions and contract to a minimum size, then if it's container is too small for innerPanel I want scroll bars to appear. Obviously the simple solution here is to set AutoScroll to true on innerPanel and anchor it to all four sides, but in my real application there are several innerPanels and it would look ridiculous to have seven scroll bars on the page. Thank you in advance.

    L 1 Reply Last reply
    0
    • E eggsovereasy

      I have a situation where I have a panel inside another panel (we'll call them innerPanel and outerPanel). outerPanel is anchored on all four sides so it expands and contracts with the window. outerPanel also has the AutoScroll property set to true. If I put innerPanel inside outerPanel and anchor it left, right, and top then when I make the window very short scroll bars appear on outerPanel. However, innerPanel's height will not expand when I expand the window. This is what I expect to happen. If I set the anchors on innerPanel to all four sides it expands and contracts with the window. However, sometimes innerPanel shrinks too small to see it's contents. This is the behavior I expect. Now, if I set a minimum width on innerPanel and anchor to all four sides it will expand with the window like I want, but when I reach that minimum size innerPanel just gets cut off, the scroll bars never appear. This is absolutely not what I expect. Am I doing something wrong? I want innerPanel to expand freely in all directions and contract to a minimum size, then if it's container is too small for innerPanel I want scroll bars to appear. Obviously the simple solution here is to set AutoScroll to true on innerPanel and anchor it to all four sides, but in my real application there are several innerPanels and it would look ridiculous to have seven scroll bars on the page. Thank you in advance.

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      Hi, if anchors, docking, autosize and what have you, don't perform as you would like them to, there is a straightforward solution: don't use them at all, and write some code instead, in the OnResize method of the relevant panels. That's what I used to do from day one, until I discovered some cases (particularly the simple ones) could be solved by setting anchors and so. The advantage is you can make it do whatever you can come up, you don't have to fight the built-in functionality, not even read the documentation... :)

      Luc Pattyn [Forum Guidelines] [My Articles]


      This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.


      E 1 Reply Last reply
      0
      • L Luc Pattyn

        Hi, if anchors, docking, autosize and what have you, don't perform as you would like them to, there is a straightforward solution: don't use them at all, and write some code instead, in the OnResize method of the relevant panels. That's what I used to do from day one, until I discovered some cases (particularly the simple ones) could be solved by setting anchors and so. The advantage is you can make it do whatever you can come up, you don't have to fight the built-in functionality, not even read the documentation... :)

        Luc Pattyn [Forum Guidelines] [My Articles]


        This month's tips: - before you ask a question here, search CodeProject, then Google; - the quality and detail of your question reflects on the effectiveness of the help you are likely to get; - use PRE tags to preserve formatting when showing multi-line code snippets.


        E Offline
        E Offline
        eggsovereasy
        wrote on last edited by
        #3

        Thanks for the reply. I figured that is what I would end up needing to do, but I wanted to see if anyone had other ideas. Anchors do what I need them to do 90% of the time so it's frustrating when they don't do what I want :p

        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