Solved

Obtaining the size of scroll bars

Posted on 1998-08-31
5
173 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
centeredAverage challenge 8 185
zeroFront challenge 7 121
wordmultiple challenge 12 154
Message not shown 5 82
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: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

740 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