Solved

Obtaining the size of scroll bars

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

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

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…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
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.

777 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