You must Sign In to post a response.
  • Category: .NET

    How to add both scroll bars into panel?

    I got issue in adding vertical and horizontal scroll bars in panel occupying full form size.
    My application working good in high resolution say (1366 x 768) but when I want to run this application into lower resolutions like (1024 X 700) when forms controls get cutted and not properly shown in form. So all I have to do is to make form able to running perfectly in any resolution , if resolution is minimum than actual form size it will allow scroll bars to see full controls.

    help me out .
  • #766012
    Hi,
    Try any of this:

    <asp:Panel runat="server" ID="panel1" ScrollBars="Both" Wrap="false" Height="1300px" Width="1400px" ></asp:Panel>
    <asp:Panel runat="server" ID="panel2" Style="overflow-y: scroll; overflow-x: scroll;" Height="1300px" Width="1400px"></asp:Panel>

  • #766020
    If you want to make your windows application as resolution independent then Docking and anchor can help of course. Just look in the Properties of the control how you want to be resolution independent and set the docking, then the control automatically resizes too when the form does. In creating a Form containing controls we have to decide whether the Forms should be resizable. Adjust any one of the values to the FormBorderStyle property to configure the reusability of the Form.
    Here are some points you can take care
    1. Use table layout panel
    2. Drag control in cell of tablelayoutpanel and set anchor and dock property.
    3. Set rowspan and colspan properties of dragged control to merge cells
    4. Set margin and padding of dragged control with respect to cell.
    5. drag all controls and follow same steps, complete design using tablelayoutpanel
    6. Now set all columns and rows size of tablelayoutpanel = autosize (or in %)
    7. Set tablelayoutpanel properties autosize = true,autosizemode = grow and shrink
    8. Set Forms properties autosize = true,autosizemode = grow and shrink

    Thanks
    Koolprasd2003
    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #766026
    Hi,

    Look at your design-time generated form code (as C# source) and find all immediate constants of integer types. You should not find a single one that defined a size or location of any controls.
    Exclusions are: font size, form size — current and minimum/maximum — and padding. In other words, all controls should be docked and aligned using padding.
    You should do another simple check: change your form width/height drastically — layout should keep its sanity. If you should preserve aspect ratio of some elements, you should perform proper re-calculations in Resize event. Never use anchors — not only they use constants, they also tend to cause some flicker in resize.
    If you observe all this, you layout will tolerate screen size.

    Additionally and optionally, you can read Screen size and change form size proportionally before you show it. (You can call some function with all adjustments and settings in a last line of the form constructor (right after a call to InitializeComponent()).

    Forget about intellisense: what, is it difficult to see source code (from meta-data) or Help? By the way there is not SetDockStyle, there is the property Dock — don't blame your intellisense.

    Alternative advice: switch to WPF, where all that problems are already well solved, including zoom and aspect ratio. Also, performance is way too superior compared to Forms.

  • #766055
    Can you check the following?

    Set autosizemode = grow and shrink
    Set rowspan and colspan properties of the control to merge cells
    Set margin and padding of the control with corresponding to cell.
    Set Forms properties autosize = true

    By Nathan
    Direction is important than speed


  • Sign In to post your comments