?
Solved

Scrollbar button size

Posted on 1997-08-25
1
Medium Priority
?
478 Views
Last Modified: 2008-03-03
I am using a standard scrollbar control as a spin control for a numeric textbox (VB4.0a 16 bit).
 
The problem is that the size of the scrollbar button can change depending on the window setting (for example, the scrollbar button is larger in the standard window scheme than in the Rainy Day scheme). I want to hide all of the scrollbar except the buttons behind the textbox.
 
Is there anyway to determine the size of the scroll bar buttons.
0
Comment
Question by:sportsfan
[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
1 Comment
 
LVL 3

Accepted Solution

by:
ChrisLewis earned 400 total points
ID: 1432128
You can determine lots of information regardging sizes using the GetSystemMetrics API call

IN VB 4/16, Declare the following:

Declare Function GetSystemMetrics% Lib "user" (ByVal nIndex%)
     Const SM_CXSCREEN = 0        ' Width of screen
     Const SM_CYSCREEN = 1        ' Height of screen
     Const SM_CXFULLSCREEN = 16   ' Width of window client area
     Const SM_CYFULLSCREEN = 17   ' Height of window client area
     Const SM_CYMENU = 15         ' Height of menu
     Const SM_CYCAPTION = 4       ' Height of caption or title
     Const SM_CXFRAME = 32        ' Width of window frame
     Const SM_CYFRAME = 33        ' Height of window frame
     Const SM_CXHSCROLL = 21      ' Width of arrow bitmap on
                                  '  horizontal scroll bar
     Const SM_CYHSCROLL = 3       ' Height of arrow bitmap on
                                  '  horizontal scroll bar
     Const SM_CXVSCROLL = 2       ' Width of arrow bitmap on
                                  '  vertical scroll bar
     Const SM_CYVSCROLL = 20      ' Height of arrow bitmap on
                                  '  vertical scroll bar
     Const SM_CXSIZE = 30         ' Width of bitmaps in title bar
     Const SM_CYSIZE = 31         ' Height of bitmaps in title bar
     Const SM_CXCURSOR = 13       ' Width of cursor
     Const SM_CYCURSOR = 14       ' Height of cursor
     Const SM_CXBORDER = 5        ' Width of window frame that cannot
                                  '  be sized
     Const SM_CYBORDER = 6        ' Height of window frame that cannot
                                  '  be sized
     Const SM_CXDOUBLECLICK = 36  ' Width of rectangle around the
                                  '  location of the first click. The
                                  '  second click must occur in the
                                  '  same rectangular location.
     Const SM_CYDOUBLECLICK = 37  ' Height of rectangle around the
                                  '  location of the first click. The
                                  '  second click must occur in the
                                  '  same rectangular location.
     Const SM_CXDLGFRAME = 7      ' Width of dialog frame window
     Const SM_CYDLGFRAME = 8      ' Height of dialog frame window
     Const SM_CXICON = 11         ' Width of icon
     Const SM_CYICON = 12         ' Height of icon
     Const SM_CXICONSPACING = 38  ' Width of rectangles the system
                                  ' uses to position tiled icons
     Const SM_CYICONSPACING = 39  ' Height of rectangles the system
                                  ' uses to position tiled icons
     Const SM_CXMIN = 28          ' Minimum width of window
     Const SM_CYMIN = 29          ' Minimum height of window
     Const SM_CXMINTRACK = 34     ' Minimum tracking width of window
     Const SM_CYMINTRACK = 35     ' Minimum tracking height of window
     Const SM_CXHTHUMB = 10       ' Width of scroll box (thumb) on
                                  '  horizontal scroll bar
     Const SM_CYVTHUMB = 9        ' Width of scroll box (thumb) on
                                  '  vertical scroll bar
     Const SM_DBCSENABLED = 42    ' Returns a non-zero if the current
                                  '  Windows version uses double-byte
                                  '  characters, otherwise returns
                                  '  zero
     Const SM_DEBUG = 22          ' Returns non-zero if the Windows
                                  '  version is a debugging version
     Const SM_MENUDROPALIGNMENT = 40
                                  ' Alignment of pop-up menus. If zero,
                                  '  left side is aligned with
                                  '  corresponding left side of menu-
                                  '  bar item. If non-zero, left side
                                  '  is aligned with right side of
                                  '  corresponding menu bar item
     Const SM_MOUSEPRESENT = 19   ' Non-zero if mouse hardware is
                                  '  installed
     Const SM_PENWINDOWS = 41     ' Handle of Pen Windows dynamic link
                                  '  library if Pen Windows is
                                  '  installed
     Const SM_SWAPBUTTON = 23     ' Non-zero if the left and right
                                  ' mouse buttons are swapped


You can then call:
>  HeightY% = GetSystemMetrics(SM_CYVSCROLL)
>  WidthX% = GetSystemMetrics(SM_CXVSCROLL)
For a vertical scroll bar, and
>  HeightY% = GetSystemMetrics(SM_CYHSCROLL)
>  WidthX% = GetSystemMetrics(SM_CXHSCROLL)
For a horizontal scroll bar.

You can then resize your scroll bar based off of these sizes.

Hope this helps!

Chris
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

765 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