Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
Scroll my control without flicker effect Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
13-Sep-02
Category
VCL-General
Language
Delphi All Versions
Views
46
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: William Gerbert

Scroll my control without flicker effect

Answer:

The easiest way to scroll the elements of a control is to force a complete repaint 
of the control. Unfortunately this produces the flicker effect. You may use

InvalidateRect(MyControl.Handle, nil, FALSE);

(important: last parameter = FALSE) to cause a complete redraw without erasing the 
background.

The best way to reduce this flickering is to use the ScrollWindow or ScrollWindowEx 
Windows API function. Look them up in your Win32.HLP file.

Another source of flickering can be from Windows using two messages to paint: 
WM_PAINT and WM_ERASEBKGND.

You may want to intercept all of the WM_ERASEBKGND messages and do all of your 
painting, including the background, in response to WM_PAINT messages in the Paint 
method:


1   type
2       TMyComponent = class(TWinControl)
3       // ..
4         protected
5             procedure WMEraseBkgnd(var message: TWMEraseBkgnd);
6             message WM_ERASEBKGND;
7       // ..
8        
9     end;
10  
11    // ..
12  
13  procedure TBMyComponent.WMEraseBkgnd(var message: TWMEraseBkgnd);
14  begin
15    message.Result := 0
16  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC