Board index » cppbuilder » Smooth and Fast Text Scrolling

Smooth and Fast Text Scrolling

Hi All

I'm in need of some advice please.  I am trying to achieve smooth text
scrolling in builder 3.  I can achieve this OK with direct X technology but
the application I am developing involves running video as well (avi, mpeg)
and I'm not ok with direct show / animation yet.

Anyway I tried various ways such as using TImage->CopyRect to achieve the
smooth scroll but the canvas still produces a flicker now and again.

Any help / sample code would be much appreciated.

Thanks
Sam

 

Re:Smooth and Fast Text Scrolling


Hi All

I'm in need of some advice please.  I am trying to achieve smooth text
scrolling in builder 3.  I can achieve this OK with direct X technology but
the application I am developing involves running video as well (avi, mpeg)
and I'm not ok with direct show / animation yet.

Anyway I tried various ways such as using TImage->CopyRect to achieve the
smooth scroll but the canvas still produces a flicker now and again.

Any help / sample code would be much appreciated.

Thanks
Sam

Re:Smooth and Fast Text Scrolling


On Tue, 28 Sep 1999 16:49:11 +0100, "Sam Sherwin"

Quote
<samsher...@pubtv.freeserve.co.uk> wrote:
>Anyway I tried various ways such as using TImage->CopyRect to achieve the
>smooth scroll but the canvas still produces a flicker now and again.

Render your image to an offscreen TBitmap and copy it to the onscreen
Canvas. As for the scrolling operation, you can just move the memory
corresponding to the section to be scrolled.

Re:Smooth and Fast Text Scrolling


Try the following function ScrollDC.
The hDC parameter should simply be Canvas->Handle.
dx and dy are simple enough, and I just use NULL for the last four
parameters.
Good luck
PHiL.

The ScrollDC function scrolls a rectangle of bits horizontally and
vertically.

BOOL ScrollDC(

    HDC hDC, // handle of 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 of scrolling region
    LPRECT lprcUpdate  // address of structure for update rectangle
   );

Parameters

hDC

Identifies 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

Points to the RECT structure containing the coordinates of the scrolling
rectangle.

lprcClip

Points 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

Identifies the region uncovered by the scrolling process. ScrollDC defines
this region; it is not necessarily a rectangle.

lprcUpdate

Points 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 the InvalidateRgn 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, call GetLastError.

Remarks

If the lprcUpdate parameter is NULL, Windows does not compute the update
rectangle. If both the hrgnUpdate and lprcUpdate parameters are NULL,
Windows does not compute the update region. If hrgnUpdate is not NULL,
Windows proceeds as though it contains a valid handle of the region
uncovered by the scrolling process (defined by ScrollDC).
When you must scroll the entire client area of a window, use the
ScrollWindow function; otherwise, use ScrollDC.

See Also

InvalidateRgn, RECT, ScrollWindow

--

Quote
Sam Sherwin <samsher...@pubtv.freeserve.co.uk> wrote in message

news:7sqns8$56010@forums.borland.com...
Quote
> Hi All

> I'm in need of some advice please.  I am trying to achieve smooth text
> scrolling in builder 3.  I can achieve this OK with direct X technology
but
> the application I am developing involves running video as well (avi, mpeg)
> and I'm not ok with direct show / animation yet.

> Anyway I tried various ways such as using TImage->CopyRect to achieve the
> smooth scroll but the canvas still produces a flicker now and again.

> Any help / sample code would be much appreciated.

> Thanks
> Sam

Other Threads