|
-
May 22nd, 2001, 02:01 PM
#1
Thread Starter
Fanatic Member
Scrollin'
Anybody used the ScrollDC and ScrollWindow API?
-
May 23rd, 2001, 07:33 AM
#2
Frenzied Member
No but here is some info on it:
Code:
ScrollDC
The ScrollDC function scrolls a rectangle of bits horizontally and vertically.
BOOL ScrollDC(
HDC hDC, // handle to device context
int dx, // horizontal scroll units
int dy, // vertical scroll units
CONST RECT *lprcScroll,
// address of structure for scrolling rectangle
CONST RECT *lprcClip,
// address of structure for clipping rectangle
HRGN hrgnUpdate, // handle to scrolling region
LPRECT lprcUpdate
// address of structure for update rectangle
);
Parameters
hDC
Handle to the device context that contains the bits to be scrolled.
dx
Specifies the amount, in device units, of horizontal scrolling. This parameter must be a negative value to scroll to the left.
dy
Specifies the amount, in device units, of vertical scrolling. This parameter must be a negative value to scroll up.
lprcScroll
Pointer to theRECT structure containing the coordinates of the scrolling rectangle.
lprcClip
Pointer to the RECT structure containing the coordinates of the clipping rectangle. Only device bits within the clipping rectangle are affected. Bits scrolled from the outside of the rectangle to the inside are painted; bits scrolled from the inside of the rectangle to the outside are not painted.
hrgnUpdate
Handle to the region uncovered by the scrolling process. ScrollDC defines this region; it is not necessarily a rectangle.
lprcUpdate
Pointer to the RECT structure that receives the coordinates of the rectangle bounding the scrolling update region. This is the largest rectangular area that requires repainting. When the function returns, the values in the structure are in client coordinates, regardless of the mapping mode for the specified device context. This allows applications to use the update region in a call to theInvalidateRgn function, if required.
Return Values
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, callGetLastError.
Remarks
If the lprcUpdate parameter is NULL, the system does not compute the update rectangle. If both the hrgnUpdate and lprcUpdate parameters are NULL, the system does not compute the update region. If hrgnUpdate is not NULL, the system proceeds as though it contains a valid handle to the region uncovered by the scrolling process (defined by ScrollDC).
When you must scroll the entire client area of a window, use the ScrollWindowEx function.
Code:
ScrollWindow
The ScrollWindow function scrolls the content of the specified window's client area. The ScrollWindow function exists for backward compatibility. New applications should use the ScrollWindowEx function.
BOOL ScrollWindow(
HWND hWnd, // handle to window to scroll
int XAmount, // amount of horizontal scrolling
int YAmount, // amount of vertical scrolling
CONST RECT *lpRect,
// address of structure with scroll rectangle
CONST RECT *lpClipRect
// address of structure with clip rectangle
);
Parameters
hWnd
Handle to the window where the client area is to be scrolled.
XAmount
Specifies the amount, in device units, of horizontal scrolling. If the window being scrolled has the CS_OWNDC or CS_CLASSDC style, then this parameter uses logical units rather than device units. This parameter must be a negative value to scroll the content of the window to the left.
YAmount
Specifies the amount, in device units, of vertical scrolling. If the window being scrolled has the CS_OWNDC or CS_CLASSDC style, then this parameter uses logical units rather than device units. This parameter must be a negative value to scroll the content of the window up.
lpRect
Pointer to theRECT structure specifying the portion of the client area to be scrolled. If this parameter is NULL, the entire client area is scrolled.
lpClipRect
Pointer to the RECT structure containing the coordinates of the clipping rectangle. Only device bits within the clipping rectangle are affected. Bits scrolled from the outside of the rectangle to the inside are painted; bits scrolled from the inside of the rectangle to the outside are not painted.
Return Values
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, callGetLastError.
Remarks
If the caret is in the window being scrolled, ScrollWindow automatically hides the caret to prevent it from being erased and then restores the caret after the scrolling is finished. The caret position is adjusted accordingly.
The area uncovered by ScrollWindow is not repainted, but it is combined into the window's update region. The application eventually receives a WM_PAINT message notifying it that the region must be repainted. To repaint the uncovered area at the same time the scrolling is in action, call the UpdateWindow function immediately after calling ScrollWindow.
If the lpRect parameter is NULL, the positions of any child windows in the window are offset by the amount specified by the XAmount and YAmount parameters; invalid (unpainted) areas in the window are also offset. ScrollWindow is faster when lpRect is NULL.
If lpRect is not NULL, the positions of child windows are not changed and invalid areas in the window are not offset. To prevent updating problems when lpRect is not NULL, call UpdateWindow to repaint the window before calling ScrollWindow.
-
May 23rd, 2001, 12:57 PM
#3
Thread Starter
Fanatic Member
Tx for the information, Vlatko.
I searched the net for these API but did not find anything. Very strange. Aren't they used frequently?
I did not have the courage to take a closer look at thise information (also found in PSDK), that's why I put this thread alive.
-
May 23rd, 2001, 02:51 PM
#4
Yes, they are used frequently (even though it might not seem like it). They occur when you scroll a window (e.g: a TextBox).
-
May 25th, 2001, 11:44 AM
#5
Thread Starter
Fanatic Member
Yes, and also for smoothly scrolling listboxes.
I just find something on the web at http://www.larry.nu/vb/koden.html
It's VB3 code but unfortunately all sources are binary encoded, so I can't view them in VB6 or something.
I'll have to examine them at work where we still have VB3.
Tx for responding, Meg.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|