Solved

Flicker problem with TImage

Posted on 1998-03-03
9
1,005 Views
Last Modified: 2008-02-01


If I set the Height or Width of my TImage object to be different from a bitmap
loaded into it then any drawing on the bitmap causes the whole bitmap to
flicker. This doesn't happen if the Height and Width are the same as the bitmap.

I want to do this so i can use the stretch property to zomm the image up in size.

Any ideas how to stop the flicker?

Cheers Chris
0
Comment
Question by:chrishart
  • 4
  • 4
9 Comments
 
LVL 5

Expert Comment

by:JimBob091197
ID: 1360057
I have had a similar problem before.  Without spending a lot of time on TImage, I quickly switched to TPaintBox.  You can use TPaintBox.Canvas.StretchDraw(...) to accomplish your zooming.

JB

0
 

Author Comment

by:chrishart
ID: 1360058
Hello JimBob,

Perhaps I should have mentioned I'm using C++Builder which I guess is similar to Delphi 2. Is TPaintBox a Delphi 3 enhancement?

Thanks Chris.
0
 
LVL 5

Expert Comment

by:JimBob091197
ID: 1360059
Hi

TPaintBox exists in Delphi 2 & Delphi 3 (and Delphi 1).  It is on the "System" component tab (same tab as TTimer in Delphi).

Regards,
JB
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

Author Comment

by:chrishart
ID: 1360060
Hello JimBob,

Thanks for your patience! I have started to use TPaintBox and it feels faster and better. Thanks.

I have noticed, however, that if another window moves across it, it does not get refreshed and chunks can get missing. Is there an easy way to keep it refreshed automatically?

Cheers Chris.

BTW I think you should get the points for this!
0
 
LVL 5

Expert Comment

by:JimBob091197
ID: 1360061
Hi Chris

When another window moves in front of the paintbox, the paintbox's OnPaint *should* be fired, which allows the paintbox to be redrawn.  Is your OnPaint event not working 100%?

JB
0
 
LVL 3

Expert Comment

by:williams2
ID: 1360062
You could overwrite TImage's Update method, by it's usual code and an bit of code testing for Vertical Blank event, or you could code a function waiting for the VBlank update, and then resize the Image, BUT it's not working all time, since the way pictures may be updated is not similar in hardware (I've have been testing it with VGA only!) ..I'll have to look up some code first.
0
 

Author Comment

by:chrishart
ID: 1360063
Thanks for your comments williams2, however I have just got JimBobs PaintBox suggestion to work and its seems fine! But thank you for the alternative.

JimBob if you turn your comment into an answer I would be pleased to award you the points.

Thnaks again that was invaluable help

Cheers Chris
0
 
LVL 5

Accepted Solution

by:
JimBob091197 earned 300 total points
ID: 1360064
Hi Chris,
Glad the PaintBox works for you.

Regards,
JB
0
 

Author Comment

by:chrishart
ID: 1360065
Thanks again for the guiding me through this!

Chris
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Convert Jpg /PNG To GIF 5 150
how to resize animated Gif image in delphi ? 1 35
Dev express lookupcombo 3 34
RESTRequest Parameter 4 42
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question