How do i get the vertical scrollbar width???? HELP

How do i get the vertical scrollbar width???? HELP

Post by Albert » Mon, 25 Oct 1999 04:00:00



Hi,

How do I get the control vertical scrollbar width (in pixels)?

Thanks in advance

Alberto.

 
 
 

How do i get the vertical scrollbar width???? HELP

Post by Roger Abbot » Tue, 26 Oct 1999 04:00:00




Quote:> Hi,

> How do I get the control vertical scrollbar width (in pixels)?

Alberto,

Call GetSystemMetrics(SM_CXVSCROLL)

You can get lots of metrics from this call, a list is below.
--
Roger Abbott, RHA (Minisystems) Ltd
http://www.rhaminisys.com
DDE FAQ and tools, DDE Client component for Visual Basic
Program launcher/setup menu, freeware, shareware

SM_CMOUSEBUTTONS        Number of buttons on mouse, or zero if no mouse
is installed.
SM_CXBORDER, SM_CYBORDER        The width and height, in pixels, of a
window border. This is equivalent to the SM_CXEDGE value for windows
with the 3D look.
SM_CXCURSOR, SM_CYCURSOR        Width and height, in pixels, of a
cursor. These are the cursor dimensions supported by the current
display driver. The system cannot create cursors of other sizes.
SM_CXDLGFRAME,SM_CYDLGFRAME     Thickness, in pixels, of the frame
around the perimeter of a window that has a caption but is not
sizeable. SM_CXDLGFRAME is the width of the horizontal border and
SM_CYDLGFRAME is the height of the vertical border. Windows 95 only:
Obsolete; use SM_CXFIXEDFRAME and SM_CYFIXEDFRAME instead.
SM_CXDOUBLECLK, SM_CYDOUBLECLK  Width and height, in pixels, of the
rectangle around the location of a first click in a double-click
sequence. The second click must occur within this rectangle for the
system to consider the two clicks a double-click.. (The two clicks must
also occur within a specified time.)
SM_CXFRAME,SM_CYFRAME   Thickness, in pixels, of the sizing border
around the perimeter of a window that can be resized. SM_CXFRAME is the
width of the horizontal border and SM_CYFRAME is the height of the
vertical border.Windows 95 only: Obsolete; use SM_CXSIZEFRAME and
SM_CYSIZEFRAME instead.
SM_CXFULLSCREEN, SM_CYFULLSCREEN        Width and height of the client
area for a full-screen window.
SM_CXHSCROLL, SM_CYHSCROLL      Width, in pixels, of the arrow bitmap
on a horizontal scrollbar; and height, in pixels, of a horizontal
scrollbar.
SM_CXHTHUMB     Width, in pixels, of the thumb box in a horizontal
scrollbar.
SM_CXICON, SM_CYICON    The default width and height, in pixels, of an
icon. These values are typically 32x32, but can vary depending on the
installed display hardware.Windows 95 only: The LoadIcon function can
only load icons of these dimensions.
SM_CXICONSPACING, SM_CYICONSPACING      Windows NT only: Width and
height, in pixels, of rectangular cell that Program Manager uses to
position tiled icons.Windows 95 only: Dimensions, in pixels, of a grid
cell for items in large icon view. Each item fits into a rectangle of
this size when arranged. These values are always greater than or equal
to SM_CXICON and SM_CYICON.
SM_CXMIN, SM_CYMIN      Minimum width and height, in pixels, of a
window.
SM_CXMINTRACK, SM_CYMINTRACK    Minimum tracking width and height, in
pixels, of a window. The user cannot drag the window frame to a size
smaller than these dimensions. A window can override these values by
processing the WM_GETMINMAXINFO message.
SM_CXSCREEN, SM_CYSCREEN        Width and height, in pixels, of the
screen.
SM_CXSIZE, SM_CYSIZE    Width and height, in pixels, of a button in a
window's caption or title bar.
SM_CXVSCROLL, SM_CYVSCROLL      Width, in pixels, of a vertical
scrollbar; and height, in pixels, of the arrow bitmap on a vertical
scrollbar.
SM_CYCAPTION    Height, in pixels, of normal caption area.
SM_CYKANJIWINDOW        For double-byte character set versions of
Windows, height, in pixels, of the Kanji window at the bottom of the
screen.
SM_CYMENU       Height, in pixels, of single-line menu bar.
SM_CYVTHUMB     Height , in pixels, of the thumb box in a vertical
scrollbar.
SM_DBCSENABLED  TRUE or non-zero if the double-byte character set
(DBCS) version of USER.EXE is installed; FALSE, or zero otherwise.
SM_DEBUG        TRUE or non-zero if the debugging version of USER.EXE
is installed; FALSE, or zero, otherwise.
SM_MENUDROPALIGNMENT    TRUE, or non-zero if pop-up menus are right-
aligned relative to the corresponding menu-bar item; FALSE, or zero if
they are left-aligned.
SM_MOUSEPRESENT TRUE or non-zero if a mouse is installed; FALSE, or
zero, otherwise.
SM_PENWINDOWS   TRUE or non-zero if the Microsoft Windows for Pen
computing extensions are installed; zero, or FALSE, otherwise.
SM_SHOWSOUNDS   TRUE or non-zero if the user requires an application to
present information visually in situations where it would otherwise
present the information only in audible form; FALSE, or zero, otherwise.
SM_SWAPBUTTON   TRUE or non-zero if the meanings of the left and right
mouse buttons are swapped; FALSE, or zero, otherwise.
SM_ARRANGE      Windows 95 only: Flags specifying how the system
arranged minimized windows. For more information about minimized
windows, see the following Remarks section.
SM_CLEANBOOT    Windows 95 only: Value that specifies how the system
was started:0   Normal boot1    Fail-safe boot2 Fail-safe with network
bootFail-safe boot (also called SafeBoot) bypasses the user's startup
files.
SM_CMETRICS     Windows 95 only: Number of system metrics and flags.
SM_CXDRAG, SM_CYDRAG    Windows 95 only: Width and height, in pixels,
of a rectangle centered on a drag point to allow for limited movement
of the mouse pointer before a drag operation begins. This allows the
user to click and release the mouse button easily without
unintentionally starting a drag operation.
SM_CXEDGE, SM_CYEDGE    Windows 95 only: Dimensions, in pixels, of a 3D
border. These are the 3D counterparts of SM_CXBORDER and SM_CYBORDER.
SM_CXFIXEDFRAME,SM_CYFIXEDFRAME Windows 95 only: Thickness, in pixels,
of the frame around the perimeter of a window that has a caption but is
not sizeable. SM_CXFIXEDFRAME is the width of the horizontal border and
SM_CYFIXEDFRAME is the height of the vertical border. Formerly
SM_CXDLGFRAME and SM_CYDLGFRAME.
SM_CXMAXIMIZED,SM_CYMAXIMIZED   Windows 95 only: Default dimensions, in
pixels, of a maximized top-level window.
SM_CXMAXTRACK,SM_CYMAXTRACK     Windows 95 only: Default maximum
dimensions, in pixels, of a window that has a caption and sizing
borders. The user cannot drag the window frame to a size larger than
these dimensions. A window can override these values by processing the
WM_GETMINMAXINFO message.
SM_CXMENUCHECK,SM_CYMENUCHECK   Windows 95 only: Dimensions, in pixels,
of the default menu check-mark bitmap.
SM_CXMENUSIZE,SM_CYMENUSIZE     Windows 95 only: Dimensions, in pixels,
of menu bar buttons (such as multiple document (MIDI) child close).
SM_CXMINIMIZED,SM_CYMINIMIZED   Windows 95 only: Dimensions, in pixels,
of a normal minimized window.
SM_CXMINSPACINGSM_CYMINSPACING  Windows 95 only: Dimensions, in pixels,
of a grid cell for minimized windows. Each minimized window fits into a
rectangle this size when arranged. These values are always greater than
or equal to SM_CXMINIMIZED and SM_CYMINIMIZED.
SM_CXSIZEFRAME,SM_CYSIZEFRAME   Windows 95 only: Thickness, in pixels,
of the sizing border around the perimeter of a window that can be
resized. SM_CXSIZEFRAME is the width of the horizontal border and
SM_CYSIZEFRAME is the height of the vertical border. Formerly
SM_CXFRAME and SM_CYFRAME.
SM_CXSMICON,SM_CYSMICON Windows 95 only: Recommended dimensions, in
pixels, of a small icon. Small icons typically appear in window
captions and in small icon view.
SM_CXSMSIZESM_CYSMSIZE  Windows 95 only: Dimensions, in pixels, of
small caption buttons.
SM_CYSMCAPTION  Windows 95 only: Height, in pixels, of a small caption.
SM_MIDEASTENABLED       Windows 95 only: TRUE if the system is enabled
for Hebrew/Arabic languages.
SM_NETWORK      Windows 95 only: The least significant bit is set if a
network is present; otherwise, it is cleared. The other bits are
reserved for future use.
SM_SECURE       Windows 95 only: TRUE if security is present, FALSE
otherwise.
SM_SLOWMACHINE  Windows 95 only: TRUE if the computer has a low-end
(slow) processor, FALSE otherwise.

Sent via Deja.com http://www.deja.com/
Before you buy.

 
 
 

How do i get the vertical scrollbar width???? HELP

Post by René Whitwort » Tue, 26 Oct 1999 04:00:00


Hi Alberto,

check out SystemParametersInfo() on MSDN

--
Hope this helps ...

Rene Whitworth
Whitworth Software Solutions - Germany
http://www.w-s-s.de/Developer
Please reply to the newsgroup :-)



Quote:> Hi,

> How do I get the control vertical scrollbar width (in pixels)?

> Thanks in advance

> Alberto.

 
 
 

How do i get the vertical scrollbar width???? HELP

Post by Albert » Tue, 26 Oct 1999 04:00:00


Thanks!!!!




> > Hi,

> > How do I get the control vertical scrollbar width (in pixels)?

> Alberto,

> Call GetSystemMetrics(SM_CXVSCROLL)

> You can get lots of metrics from this call, a list is below.
> --
> Roger Abbott, RHA (Minisystems) Ltd
> http://www.rhaminisys.com
> DDE FAQ and tools, DDE Client component for Visual Basic
> Program launcher/setup menu, freeware, shareware

> SM_CMOUSEBUTTONS Number of buttons on mouse, or zero if no mouse
> is installed.
> SM_CXBORDER, SM_CYBORDER The width and height, in pixels, of a
> window border. This is equivalent to the SM_CXEDGE value for windows
> with the 3D look.
> SM_CXCURSOR, SM_CYCURSOR Width and height, in pixels, of a
> cursor. These are the cursor dimensions supported by the current
> display driver. The system cannot create cursors of other sizes.
> SM_CXDLGFRAME,SM_CYDLGFRAME Thickness, in pixels, of the frame
> around the perimeter of a window that has a caption but is not
> sizeable. SM_CXDLGFRAME is the width of the horizontal border and
> SM_CYDLGFRAME is the height of the vertical border. Windows 95 only:
> Obsolete; use SM_CXFIXEDFRAME and SM_CYFIXEDFRAME instead.
> SM_CXDOUBLECLK, SM_CYDOUBLECLK Width and height, in pixels, of the
> rectangle around the location of a first click in a double-click
> sequence. The second click must occur within this rectangle for the
> system to consider the two clicks a double-click.. (The two clicks must
> also occur within a specified time.)
> SM_CXFRAME,SM_CYFRAME Thickness, in pixels, of the sizing border
> around the perimeter of a window that can be resized. SM_CXFRAME is the
> width of the horizontal border and SM_CYFRAME is the height of the
> vertical border.Windows 95 only: Obsolete; use SM_CXSIZEFRAME and
> SM_CYSIZEFRAME instead.
> SM_CXFULLSCREEN, SM_CYFULLSCREEN Width and height of the client
> area for a full-screen window.
> SM_CXHSCROLL, SM_CYHSCROLL Width, in pixels, of the arrow bitmap
> on a horizontal scrollbar; and height, in pixels, of a horizontal
> scrollbar.
> SM_CXHTHUMB Width, in pixels, of the thumb box in a horizontal
> scrollbar.
> SM_CXICON, SM_CYICON The default width and height, in pixels, of an
> icon. These values are typically 32x32, but can vary depending on the
> installed display hardware.Windows 95 only: The LoadIcon function can
> only load icons of these dimensions.
> SM_CXICONSPACING, SM_CYICONSPACING Windows NT only: Width and
> height, in pixels, of rectangular cell that Program Manager uses to
> position tiled icons.Windows 95 only: Dimensions, in pixels, of a grid
> cell for items in large icon view. Each item fits into a rectangle of
> this size when arranged. These values are always greater than or equal
> to SM_CXICON and SM_CYICON.
> SM_CXMIN, SM_CYMIN Minimum width and height, in pixels, of a
> window.
> SM_CXMINTRACK, SM_CYMINTRACK Minimum tracking width and height, in
> pixels, of a window. The user cannot drag the window frame to a size
> smaller than these dimensions. A window can override these values by
> processing the WM_GETMINMAXINFO message.
> SM_CXSCREEN, SM_CYSCREEN Width and height, in pixels, of the
> screen.
> SM_CXSIZE, SM_CYSIZE Width and height, in pixels, of a button in a
> window's caption or title bar.
> SM_CXVSCROLL, SM_CYVSCROLL Width, in pixels, of a vertical
> scrollbar; and height, in pixels, of the arrow bitmap on a vertical
> scrollbar.
> SM_CYCAPTION Height, in pixels, of normal caption area.
> SM_CYKANJIWINDOW For double-byte character set versions of
> Windows, height, in pixels, of the Kanji window at the bottom of the
> screen.
> SM_CYMENU Height, in pixels, of single-line menu bar.
> SM_CYVTHUMB Height , in pixels, of the thumb box in a vertical
> scrollbar.
> SM_DBCSENABLED TRUE or non-zero if the double-byte character set
> (DBCS) version of USER.EXE is installed; FALSE, or zero otherwise.
> SM_DEBUG TRUE or non-zero if the debugging version of USER.EXE
> is installed; FALSE, or zero, otherwise.
> SM_MENUDROPALIGNMENT TRUE, or non-zero if pop-up menus are right-
> aligned relative to the corresponding menu-bar item; FALSE, or zero if
> they are left-aligned.
> SM_MOUSEPRESENT TRUE or non-zero if a mouse is installed; FALSE, or
> zero, otherwise.
> SM_PENWINDOWS TRUE or non-zero if the Microsoft Windows for Pen
> computing extensions are installed; zero, or FALSE, otherwise.
> SM_SHOWSOUNDS TRUE or non-zero if the user requires an application to
> present information visually in situations where it would otherwise
> present the information only in audible form; FALSE, or zero, otherwise.
> SM_SWAPBUTTON TRUE or non-zero if the meanings of the left and right
> mouse buttons are swapped; FALSE, or zero, otherwise.
> SM_ARRANGE Windows 95 only: Flags specifying how the system
> arranged minimized windows. For more information about minimized
> windows, see the following Remarks section.
> SM_CLEANBOOT Windows 95 only: Value that specifies how the system
> was started:0 Normal boot1 Fail-safe boot2 Fail-safe with network
> bootFail-safe boot (also called SafeBoot) bypasses the user's startup
> files.
> SM_CMETRICS Windows 95 only: Number of system metrics and flags.
> SM_CXDRAG, SM_CYDRAG Windows 95 only: Width and height, in pixels,
> of a rectangle centered on a drag point to allow for limited movement
> of the mouse pointer before a drag operation begins. This allows the
> user to click and release the mouse button easily without
> unintentionally starting a drag operation.
> SM_CXEDGE, SM_CYEDGE Windows 95 only: Dimensions, in pixels, of a 3D
> border. These are the 3D counterparts of SM_CXBORDER and SM_CYBORDER.
> SM_CXFIXEDFRAME,SM_CYFIXEDFRAME Windows 95 only: Thickness, in pixels,
> of the frame around the perimeter of a window that has a caption but is
> not sizeable. SM_CXFIXEDFRAME is the width of the horizontal border and
> SM_CYFIXEDFRAME is the height of the vertical border. Formerly
> SM_CXDLGFRAME and SM_CYDLGFRAME.
> SM_CXMAXIMIZED,SM_CYMAXIMIZED Windows 95 only: Default dimensions, in
> pixels, of a maximized top-level window.
> SM_CXMAXTRACK,SM_CYMAXTRACK Windows 95 only: Default maximum
> dimensions, in pixels, of a window that has a caption and sizing
> borders. The user cannot drag the window frame to a size larger than
> these dimensions. A window can override these values by processing the
> WM_GETMINMAXINFO message.
> SM_CXMENUCHECK,SM_CYMENUCHECK Windows 95 only: Dimensions, in pixels,
> of the default menu check-mark bitmap.
> SM_CXMENUSIZE,SM_CYMENUSIZE Windows 95 only: Dimensions, in pixels,
> of menu bar buttons (such as multiple document (MIDI) child close).
> SM_CXMINIMIZED,SM_CYMINIMIZED Windows 95 only: Dimensions, in pixels,
> of a normal minimized window.
> SM_CXMINSPACINGSM_CYMINSPACING Windows 95 only: Dimensions, in pixels,
> of a grid cell for minimized windows. Each minimized window fits into a
> rectangle this size when arranged. These values are always greater than
> or equal to SM_CXMINIMIZED and SM_CYMINIMIZED.
> SM_CXSIZEFRAME,SM_CYSIZEFRAME Windows 95 only: Thickness, in pixels,
> of the sizing border around the perimeter of a window that can be
> resized. SM_CXSIZEFRAME is the width of the horizontal border and
> SM_CYSIZEFRAME is the height of the vertical border. Formerly
> SM_CXFRAME and SM_CYFRAME.
> SM_CXSMICON,SM_CYSMICON Windows 95 only: Recommended dimensions, in
> pixels, of a small icon. Small icons typically appear in window
> captions and in small icon view.
> SM_CXSMSIZESM_CYSMSIZE Windows 95 only: Dimensions, in pixels, of
> small caption buttons.
> SM_CYSMCAPTION Windows 95 only: Height, in pixels, of a small caption.
> SM_MIDEASTENABLED Windows 95 only: TRUE if the system is enabled
> for Hebrew/Arabic languages.
> SM_NETWORK Windows 95 only: The least significant bit is set if a
> network is present; otherwise, it is cleared. The other bits are
> reserved for future use.
> SM_SECURE Windows 95 only: TRUE if security is present, FALSE
> otherwise.
> SM_SLOWMACHINE Windows 95 only: TRUE if the computer has a low-end
> (slow) processor, FALSE otherwise.

> Sent via Deja.com http://www.deja.com/
> Before you buy.

 
 
 

How do i get the vertical scrollbar width???? HELP

Post by Roger Abbot » Wed, 27 Oct 1999 04:00:00




Quote:> Hi Alberto,

> check out SystemParametersInfo() on MSDN

This is not the right call, use GetSystemMetrics.

> --
> Hope this helps ...

> Rene Whitworth
> Whitworth Software Solutions - Germany
> http://www.w-s-s.de/Developer
> Please reply to the newsgroup :-)



> > Hi,

> > How do I get the control vertical scrollbar width (in pixels)?

> > Thanks in advance

> > Alberto.

--
Roger Abbott, RHA (Minisystems) Ltd
http://www.rhaminisys.com
DDE FAQ and tools, DDE Client component for Visual Basic
Program launcher/setup menu, freeware, shareware

Sent via Deja.com http://www.deja.com/
Before you buy.

 
 
 

How do i get the vertical scrollbar width???? HELP

Post by René Whitwort » Wed, 27 Oct 1999 04:00:00


Hi Roger,

Quote:> > check out SystemParametersInfo() on MSDN

> This is not the right call, use GetSystemMetrics.

actually it ain't the BEST call if you just want this info, but you'll get
it on calling SystemParametersInfo() with SPI_NONCLIENTMETRICS specified
(just look it up, it's there :-)).

--
Hope this helps ...

Rene Whitworth
Whitworth Software Solutions - Germany
http://www.w-s-s.de/Developer
Please reply to the newsgroup :-)





> > Hi Alberto,

> > check out SystemParametersInfo() on MSDN

> This is not the right call, use GetSystemMetrics.

> > --
> > Hope this helps ...

> > Rene Whitworth
> > Whitworth Software Solutions - Germany
> > http://www.w-s-s.de/Developer
> > Please reply to the newsgroup :-)



> > > Hi,

> > > How do I get the control vertical scrollbar width (in pixels)?

> > > Thanks in advance

> > > Alberto.

> --
> Roger Abbott, RHA (Minisystems) Ltd
> http://www.rhaminisys.com
> DDE FAQ and tools, DDE Client component for Visual Basic
> Program launcher/setup menu, freeware, shareware

> Sent via Deja.com http://www.deja.com/
> Before you buy.

 
 
 

How do i get the vertical scrollbar width???? HELP

Post by Martin Mile » Tue, 02 Nov 1999 04:00:00


I tried these two api-calls and i got the same result every time. It's the
same value as the one I get in the screenoptions. But there must be
something wrong with it, because when I multiply it with
screen.twipsperpixelx and use the product to resize my controls, my controls
are too small. It seems that the product is nearly three times bigger than I
expected. What's wrong? Do I have to use some kind of ratio to get the right
result?
 
 
 

How do i get the vertical scrollbar width???? HELP

Post by René Whitwort » Wed, 03 Nov 1999 04:00:00


Hi Martin,

I'm not exactly sure, but I thought these values already were in twips, so
multiplying them with TwipsPerPixelX would not be neccesary.

If you can't work it out, just post your sourcecode for this (including
declarations) here, and I'll have a look at it.

--
Hope this helps ...

Rene Whitworth
Whitworth Software Solutions - Germany
http://www.w-s-s.de/Developer
Please reply to the newsgroup :-)



Quote:> I tried these two api-calls and i got the same result every time. It's the
> same value as the one I get in the screenoptions. But there must be
> something wrong with it, because when I multiply it with
> screen.twipsperpixelx and use the product to resize my controls, my
controls
> are too small. It seems that the product is nearly three times bigger than
I
> expected. What's wrong? Do I have to use some kind of ratio to get the
right
> result?