Resize without scrollbars

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John Kraft

    Resize without scrollbars

    I have a listview control that I want the columns of to remain a
    proportional size filling the listview completely. In the listview's
    Resize method, I calculate the new sizes and all looks fine.
    Sometimes, but not always though, scrollbars appear. The scroll bar
    has nowhere to scroll (because the columns fit the listview's size
    perfectly), and if you click on the scrollbars, they disappear. Anyone
    know what's causing the bars to appear and how to keep the scrollbars
    from appearing?

    thanks,

    john
  • thi

    #2
    Re: Resize without scrollbars

    What scrollbar are we talking about? Horizontal or vertical. My guess is the
    the column header width is longer then the listview width itself which cause
    the horizontal bar to appear and that could result the vertical bar to
    appear too.

    Can't really tell without seeing what exactly going on.


    "John Kraft" <jhkraft@barbec ueguy.comwrote in message
    news:4l9ac2tgh8 tjlmea5mjd46gpp ouv5vhq4u@4ax.c om...
    >I have a listview control that I want the columns of to remain a
    proportional size filling the listview completely. In the listview's
    Resize method, I calculate the new sizes and all looks fine.
    Sometimes, but not always though, scrollbars appear. The scroll bar
    has nowhere to scroll (because the columns fit the listview's size
    perfectly), and if you click on the scrollbars, they disappear. Anyone
    know what's causing the bars to appear and how to keep the scrollbars
    from appearing?
    >
    thanks,
    >
    john

    Comment

    • John Kraft

      #3
      Re: Resize without scrollbars

      On Tue, 25 Jul 2006 11:27:43 +1200, "thi" <thithach@hotma il.com>
      wrote:
      >What scrollbar are we talking about? Horizontal or vertical. My guess is the
      >the column header width is longer then the listview width itself which cause
      >the horizontal bar to appear and that could result the vertical bar to
      >appear too.
      >
      >Can't really tell without seeing what exactly going on.
      >
      I'm sorry for not being specific enough. It is the horizontal scroll
      bar that appears. I have calculated the width of the columns (there
      are only 2 columns) like this:

      col2Width = listview.Width - col1Width - 4; // 2 pixel border

      This seems to work just fine most of the time; however, sometimes the
      h scrollbar appears. The only time it is consistently reproducable is
      when going from maximized to normalized. The rest of the times it
      seems to be random, and clicking on the right scroll button causes it
      to disappear. I have tried making my pixel border cushion bigger, but
      that doesn't seem to effect it. It's almost as if the calculations
      are not being performed each time, or the calculation is somehow
      fractional and thereby rounding up. *shrug*

      Thanks,

      john

      Comment

      • thi

        #4
        Re: Resize without scrollbars

        Assuming that all the listitems in the listview not exceed the maximum item
        count in the visible area of the listview i guess your code look ok. If not
        that will cause the vertical scroll bar to appear and of course you will
        need to recalculate the second column heard and taking into account that the
        new width now should include the vertical scrollbar width. (i think it is 15
        pixels)


        For example: say i have a listview, width = 500, height = 500, maximum item
        display in visible area: 10. Here is my code

        //Assuming the columnheader[0] default = 450;
        if (listview.items .count 10)
        {
        //This will force the listview not to show the horizontal bar but
        //still keeping vertical bar. 15 is an assumtion of the vertical bar
        width.
        listview.column header[0].width = 450 - 15;
        }
        else
        {
        listview.column header[0].width = 450 ;
        }



        "John Kraft" <jhkraft@barbec ueguy.comwrote in message
        news:11pcc2h2de c0rd6fd2me1gv2d tto4s1o4p@4ax.c om...
        On Tue, 25 Jul 2006 11:27:43 +1200, "thi" <thithach@hotma il.com>
        wrote:
        >
        >>What scrollbar are we talking about? Horizontal or vertical. My guess is
        >>the
        >>the column header width is longer then the listview width itself which
        >>cause
        >>the horizontal bar to appear and that could result the vertical bar to
        >>appear too.
        >>
        >>Can't really tell without seeing what exactly going on.
        >>
        I'm sorry for not being specific enough. It is the horizontal scroll
        bar that appears. I have calculated the width of the columns (there
        are only 2 columns) like this:
        >
        col2Width = listview.Width - col1Width - 4; // 2 pixel border
        >
        This seems to work just fine most of the time; however, sometimes the
        h scrollbar appears. The only time it is consistently reproducable is
        when going from maximized to normalized. The rest of the times it
        seems to be random, and clicking on the right scroll button causes it
        to disappear. I have tried making my pixel border cushion bigger, but
        that doesn't seem to effect it. It's almost as if the calculations
        are not being performed each time, or the calculation is somehow
        fractional and thereby rounding up. *shrug*
        >
        Thanks,
        >
        john

        Comment

        Working...