473,386 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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
Jul 24 '06 #1
3 5794
thi
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" <jh*****@barbecueguy.comwrote in message
news:4l********************************@4ax.com...
>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

Jul 24 '06 #2
On Tue, 25 Jul 2006 11:27:43 +1200, "thi" <th******@hotmail.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
Jul 25 '06 #3
thi
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.columnheader[0].width = 450 - 15;
}
else
{
listview.columnheader[0].width = 450 ;
}

"John Kraft" <jh*****@barbecueguy.comwrote in message
news:11********************************@4ax.com...
On Tue, 25 Jul 2006 11:27:43 +1200, "thi" <th******@hotmail.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

Jul 25 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Weng kin | last post by:
Hi everyone, I have a problem trying to load an image without the image resizing itself to fit into the window. My simple javascript is as follows: function viewImage(filename) { features =...
1
by: SAN CAZIANO | last post by:
how can i resize the column of a table and add both the scrollbar to it ?
3
by: alazar_076 | last post by:
Hey, I am using javascript for pop-ups, but I want each pop-up on the page to have its own resize. This is the code that I have: <HEAD> <SCRIPT TYPE="text/javascript"> <!-- function...
14
by: D. Alvarado | last post by:
Hello, I am trying to open a window containing an image and I would like the image to be flush against the window -- i.e. have no padding or border. Can I make this happen with a single call to a...
7
by: windandwaves | last post by:
Hi Folk I use a pop-up window on www.wapitipark.co.nz to view images. On some sites, I saw (a long time ago) a trick where they use Javascript to resize the window to the size of the image. ...
1
by: Miaaa Mukherjee | last post by:
Hello, I have created three different menu controls. 1)headercontrol.aspx(which contains mainimage heading and midmenu) 2)leftmenu.aspx(which contains the menu thru which we can open diff...
4
by: vbDavidC | last post by:
I have an unbound grid that is on my form (not created programmatically). I stretched the size to what I think is wide enough to accomodate the 6 columns I will be creating. I plan on making the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.