Solved

Image.beginupdate ?

Posted on 2001-08-25
6
869 Views
Last Modified: 2010-04-06
I'm doing lot of drawing on the canvas in a image, this has the bad effect that some other images on the form flickers from time to time.
Is there a way to make it more flicker free.
I thought of LockWindowUpdate but as remember this seems to make all windows flicker.
0
Comment
Question by:bnz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 34

Expert Comment

by:Slick812
ID: 6425849
I'm not sure how many times you are drawing on the image canvas, but since you said 'alot', you may want to try what's called page filpping. Whenever you draw directly on a visible canvas rapidly and a draw does NOT sync with the monitor's refresh rate you get some flicker. Try to not draw something on a part of a visible canvas. Only replace the ENTIRE image with a memory bitmap that you have drawn on. Flip a whole page to the image instead of a piece of a page. This may seem like a backwards way (more work instead of less) to do it, but it tends to sync together with the refresh rate better. Oh, a TImage has some update routines that may kick in. You may want to try a PaintBox or Do all the rapid drawing in a Rect on the Form's Canvas. If your drawing is not rapid, you could try DoubleBuffer := True;
0
 
LVL 3

Expert Comment

by:Slavak
ID: 6426002
I has the same problems with standard delphi components. Best solution I found it do NOT use it, if you want nice graphic application.
I use components from http://www.stuckindoors.com/dib/.
It solved most of my problems. The biggest disadvantage (for me) is that it cannot run in 256 colors mode.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6426668
maybe it helps to place the timage on a tpanel
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:bnz
ID: 6426715
Slick812: I tried to create an invisible image and then paint on the real image using this code     VisibleImage.Canvas.Draw(0,0, TempImage);

It helps a bit but not much, am I doing the right thing?

Slavak: thanks for you tip, the component does not work with Delphi 6 yet, so I will way for that to come.
0
 
LVL 34

Accepted Solution

by:
Slick812 earned 100 total points
ID: 6427478
yea bnz, thats the idea, , , you did not say if you are rapidly drawing on the canvas (more that 5 changes a second or so), Like I said I think the TImage has some canvas updates that kick in when you draw on it, , I do not use a TImage EVER, to do rapid drawing on it's canvas. I use a PaintBox (you can use the canvas of a TPanel too), what you will have to add is the Bitmap drawn on it in it's OnPaint event. So it will not disapear when it is refreshed. I think the TImage was made mostly for static (NON-changing) images. I beleive it handles its canvas a little differently than other controls. I have done some very rapid page flipping on a TPaintBox without the flicker (if it's size gets Large then it will slow down for the time it takes to draw the images)
0
 

Author Comment

by:bnz
ID: 6428016
Ahh now I get it. You are right, I used a paintbox and 99% flicker free :)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

707 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