Solved

Obtaining the size of scroll bars

Posted on 1998-08-31
5
169 Views
Last Modified: 2013-11-19
I'm using a multicolumned list control.  I'd like to set the column widths so that they fit neatly in the available space (that is, there's no horizontal scroll bar.)  

If I base these widths on the size returned by GetClientArea(), it works fine as long as there's no vertical scroll bar.  

I'd like to take the width of the vertical scroll bar into account - how do I find out what it is?    
0
Comment
Question by:fisham29
  • 3
  • 2
5 Comments
 
LVL 2

Accepted Solution

by:
milenvk earned 20 total points
ID: 1321506
Consider using
GetSystemMetrics(SM_CXVSCROLL)
This returns the width in pixels of the vertical scroll bar.
0
 

Author Comment

by:fisham29
ID: 1321507
Oh, maybe ::GetSystemMetrics( SM_CXVSCROLL )???

Now how do I convert from pixels to client coordinates?
0
 

Author Comment

by:fisham29
ID: 1321508
Oops - you beat me to it.   You were fast!!!  Could you indulge my second question also??
0
 

Author Comment

by:fisham29
ID: 1321509
Never mind.  I guess in MM_TEXT, pixels ARE client coordinates.
0
 
LVL 2

Expert Comment

by:milenvk
ID: 1321510
You have to calculate in order to convert the pixels to client coordinates. You can assume that the scrollbar stays to the left of the right edge of the client rectangle. Then just subtract the pixels returned by GetSystemMetrics(SM_CXVSCROLL) from the right of the client rectangle and you'll get the left edge of the scrollbar in client coordinates.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VB.NET how to use the Vertical ScrollBar 5 90
has22 challenge 11 80
mapBully challenge 6 114
Updating statistics with error notification email in SQL server 4 73
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now