Solved

Obtaining the size of scroll bars

Posted on 1998-08-31
5
168 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Error on moodle after upgrade 3 106
sumNumber challenge 16 98
move a line in eclipse 3 60
Path of Workbook 3 45
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

707 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

13 Experts available now in Live!

Get 1:1 Help Now