472,984 Members | 2,175 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Detecting presence of scrollbars in a ListView


I inherited an owner drawn control that subclasses the Windows Forms
ListView control to provide additional functionalities. I wanted to
detect the presence of the Vertical scrollbar so that I can disable a
few buttons. This code didn't work:

foreach (Control c in ownerDrawnListViewObject.Controls)
{
if (c is VScrollBar)
{
return c.Visible;
}
}

This didn't work because, to my surprise,
ownerDrawnListViewObject.Controls.Count returned 0!

Am I going about this the wrong way?

Aug 26 '08 #1
3 4823
On Aug 27, 1:39*am, Dilip <rdil...@lycos.comwrote:
I inherited an owner drawn control that subclasses the Windows Forms
ListView control to provide additional functionalities. *I wanted to
detect the presence of the Vertical scrollbar so that I can disable a
few buttons. *This code didn't work:

foreach (Control c in ownerDrawnListViewObject.Controls)
{
* * if (c is VScrollBar)
* * {
* * * * return c.Visible;
* * }

}

This didn't work because, to my surprise,
ownerDrawnListViewObject.Controls.Count returned 0!

Am I going about this the wrong way?
I think you should check for "listView.Scrollable" and work around it
to detect horizontal and veritical

-Cnu
Aug 27 '08 #2
On Aug 27, 2:24*am, Duggi <DuggiSrinivasa...@gmail.comwrote:
On Aug 27, 1:39*am, Dilip <rdil...@lycos.comwrote:
I inherited an owner drawn control that subclasses the Windows Forms
ListView control to provide additional functionalities. *I wanted to
detect the presence of the Vertical scrollbar so that I can disable a
few buttons. *This code didn't work:
foreach (Control c in ownerDrawnListViewObject.Controls)
{
* * if (c is VScrollBar)
* * {
* * * * return c.Visible;
* * }
}
This didn't work because, to my surprise,
ownerDrawnListViewObject.Controls.Count returned 0!
Am I going about this the wrong way?

I think you should check for "listView.Scrollable" and work around it
to detect horizontal and veritical

-Cnu
I believe ListView.Scrollable only ensures that the scrollbars will
show up if the entries in the ListView cannot be exceed the
displayable area. If you have only one or 2 entries for which no
scrollbar would show up, ListView.Scrollable would still return true.
That is now what I am after.
Aug 27 '08 #3
On Aug 27, 9:49*am, Dilip <rdil...@lycos.comwrote:
On Aug 27, 2:24*am, Duggi <DuggiSrinivasa...@gmail.comwrote:
On Aug 27, 1:39*am, Dilip <rdil...@lycos.comwrote:
I inherited an owner drawn control that subclasses the Windows Forms
ListView control to provide additional functionalities. *I wanted to
detect the presence of the Vertical scrollbar so that I can disable a
few buttons. *This code didn't work:
foreach (Control c in ownerDrawnListViewObject.Controls)
{
* * if (c is VScrollBar)
* * {
* * * * return c.Visible;
* * }
}
This didn't work because, to my surprise,
ownerDrawnListViewObject.Controls.Count returned 0!
Am I going about this the wrong way?
I think you should check for "listView.Scrollable" and work around it
to detect horizontal and veritical
-Cnu
Sorry.. I have a bad case of butter fingers. Let me try again:

I believe ListView.Scrollable only ensures that the scrollbars will
show up if the entries in the ListView exceed the displayable area.
If you have only one or 2 entries for which no
scrollbar would show up, ListView.Scrollable would still return true.
That is not what I am after.

Aug 27 '08 #4

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

Similar topics

5
by: MrNobody | last post by:
I have two large text boxes side by side which when loaded with text will usually get a horizontal scrollbar automatically. I would like to set it up so that when I scroll a bit to one direction...
2
by: Mark | last post by:
I have basically a 2 part question: 1) is there a way to have a listview that can scroll, but hide the scrollbars. I know that sounds odd, but this is a touch screen app and there are "scroll...
1
by: TomasFloyd | last post by:
Hi Everyone I'm using the standard ListView control of VS 2003. I would like to know if there is a way to catch the event of the scrollbars attached to a ListView being 'scrolled' or 'clicked'?...
2
by: ohadasor | last post by:
Hi All, I have a ListView control, and I need it to have only vertical scrollbar, not horizontal. How can I do that? The only way I found to control its scrollbars is using ListView.Scrollable,...
3
by: John Kraft | last post by:
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....
0
by: inandout | last post by:
Hi, I was wondering if anyone can help me with this. I have a listview that is specified to a size of: 348W x 308H When items are added to it, no problems. However when items continue to be...
1
by: deerchao | last post by:
I set ListView.Dock to Top, but how can I get the desired height to avoid it to show vertical scrollbar? I mean is there something like ListView.ClientSize or ListView.VirtualHeight? Thanks!
1
by: mrabie | last post by:
Hi All, I know this has been discussed before but i can't really find an answer to what i want to do. I am developing an application for touchscreen using C#. It's going to be a fullscreen...
1
by: =?Utf-8?B?YW5kaSByaWNrZW5iYWNo?= | last post by:
Hello, i have two listviews next to each other on a form. I would like to synchronize both vertical scrollbars of the two listviews with one scrollbar (for example VScrollBar). How can I do...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.