user4592590
user4592590

Reputation:

Does Windows API have a scrollbar control?

In Delphi, there is a component called TScrollBox, which allows you to add a scrollbar to a TImage component.

I need to add a scrollbar to an image in pure Windows API. So does Windows API have such a control? All I found is this 1993 article!

If not, then how can I add a scrollbar to my image?

Upvotes: 1

Views: 1014

Answers (2)

IInspectable
IInspectable

Reputation: 51414

The Windows API provides two types of scrollbars:

One is the standalone Scroll Bar control, that comes with its own window handle.

The other is attached to a window that has the WS_HSCROLL and/or WS_VSCROLL Window Styles. The latter is a nonclient scrollbar and not a control. Consequently it doesn't have a window handle. To manipulate a nonclient scrollbar, pass the window handle of the containing window together with the SB_HORZ or SB_VERT as the nBar parameter to the appropriate scrollbar functions.


Most complete guide to scrollbars (from The Old New Thing):

Upvotes: 16

David Heffernan
David Heffernan

Reputation: 612983

Yes, Win32 defines a scroll bar class, documented here: https://msdn.microsoft.com/en-us/library/windows/desktop/bb787529.aspx

Upvotes: 3

Related Questions