 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Chad Guest
|
Posted: Wed May 25, 2005 4:07 am Post subject: TImage repaint() issue in C++ Builder 6.0 |
|
|
I just finished upgrading from C++ Builder 3 to C++ Builder 6. One of the
programs I wrote under Builder 3 performs a simple image editing task. The
changes are applied to the TBitmap held by a TImage component, and the
repaint() function of the TImage component is then called. The image is
rather large (around 1500x1500). When compiled under Bulder 3 the
operation occurs quickly and smoothly. Under Builder 6 repaint() ocurrs
slowly enough that I can see the repaint occur. Since repaint is called
everytime the bitmap is updated, the result is a flickering appearance to
the bitmap whenever the user edits it. How can I update the bitmap and
refresh the TImage component (so the udates are actually displayed) without
having an annoying flicker effect? Thanks
Chad
|
|
| Back to top |
|
 |
Mark Jacobs Guest
|
Posted: Wed May 25, 2005 11:39 am Post subject: Re: TImage repaint() issue in C++ Builder 6.0 |
|
|
Chad wrote:
| Quote: | I just finished upgrading from C++ Builder 3 to C++ Builder 6. One of the
programs I wrote under Builder 3 performs a simple image editing task. The
changes are applied to the TBitmap held by a TImage component, and the
repaint() function of the TImage component is then called. The image is
rather large (around 1500x1500). When compiled under Bulder 3 the
operation occurs quickly and smoothly. Under Builder 6 repaint() ocurrs
slowly enough that I can see the repaint occur. Since repaint is called
everytime the bitmap is updated, the result is a flickering appearance to
the bitmap whenever the user edits it. How can I update the bitmap and
refresh the TImage component (so the udates are actually displayed) without
having an annoying flicker effect? Thanks
|
I use the following on my image zoomer, and it is very smooth :-
Image1->Canvas->CopyRect(Rect(0,0,Image1->Width,Image1->Height),mjbitmp->Canvas,
Rect(xd/fac,yd/fac,xu/fac,yu/fac));
Image1->Repaint();
Also, try putting DoubleBuffered=true; in your main form's constructor. I use
BCB5.
--
Mark Jacobs
http://www.dkcomputing.co.uk
|
|
| Back to top |
|
 |
Chad Guest
|
Posted: Thu May 26, 2005 10:33 pm Post subject: Re: TImage repaint() issue in C++ Builder 6.0 |
|
|
Thanks. The DoubleBuffered property was the key. Apparently the program
was trying to first repaint the underlying control before repainting the
TImage object. This fixed the problem
Just a quick note about DoubleBuffered for anyone else with the same
question. The DoubleBuffered property is part of the TWinControl object.
TImage does not decend from this object and does not have this property.
DoubleBuffered should be set to true for the PARENT of the TImage object.
If the TImage lies directly on the form, than set the form's DoubleBuffered
property to true. If the TImage lies on a TPanel (as in my case) setting
the TForm's DoubleBuffered property won't work. You must set the TPanel's
DoubleBuffered property to true to eliminate flicker.
Again, Thanks.
Chad
|
|
| Back to top |
|
 |
Mark Jacobs Guest
|
Posted: Fri May 27, 2005 11:36 am Post subject: Re: TImage repaint() issue in C++ Builder 6.0 |
|
|
Chad wrote:
| Quote: | Thanks. The DoubleBuffered property was the key. Apparently the program
was trying to first repaint the underlying control before repainting the
TImage object. This fixed the problem
Just a quick note about DoubleBuffered for anyone else with the same
question. The DoubleBuffered property is part of the TWinControl object.
TImage does not decend from this object and does not have this property.
DoubleBuffered should be set to true for the PARENT of the TImage object.
If the TImage lies directly on the form, than set the form's DoubleBuffered
property to true. If the TImage lies on a TPanel (as in my case) setting
the TForm's DoubleBuffered property won't work. You must set the TPanel's
DoubleBuffered property to true to eliminate flicker.
|
You're welcome. Thanks for the invaluable feedback about using the parent
control. Excellent!
--
Mark Jacobs
http://www.dkcomputing.co.uk
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|