Board index » cppbuilder » Amazing Window Flickering

Amazing Window Flickering


2006-09-28 11:18:54 AM
cppbuilder63
Hello,
I've used BCB5 and BCB6 years ago, and have just now got back to using the
VCL with Turbo C++ 2006. I've noticed severe window flickering during
resizing, and I just don't recall seeing this several years ago.
iMac
Intel Core Duo 2 GHz
2 GB Ram
XP SP2
I have a Form with a PageControl with AlignClient alignment, 3 TabSheets and
a TXPManifest. When I run this and resize, I get amazing flickering. Do
others see this, on P4 or P3 machines?
I wonder if it has something to do with the Processor, and maybe there are
no optimization for it. This machine tends to run Win32 programs very
smoothly, so I am really surprised to see this.
Any thoughts?
 
 

Re:Amazing Window Flickering

Quote
I've used BCB5 and BCB6 years ago, and have just now got back to using the
VCL with Turbo C++ 2006. I've noticed severe window flickering during
resizing, and I just don't recall seeing this several years ago.

Have you installed the hotfixes yet?
 

Re:Amazing Window Flickering

Try to set the DoubleBuffered property of your form to true and see if that
changes anything.
I have encountered problem with bcb2006 xp theming on integrated S3 graphics
controller, which was not a problem with bcb6 + thememanager. I am sure a
graphics driver update would solve the problem, since it runs fine all other
machiner. However i just resolved the problem on this particular machine by
disabling theming an use the classic win2000 look.
/Palle
 

{smallsort}

Re:Amazing Window Flickering

"Palle Meinert" < XXXX@XXXXX.COM >wrote in message
Quote
Try to set the DoubleBuffered property of your form to true and see if
that changes anything.
DoubleBuffered = true does not help. I also installed the hotfixes, and
this does not help either. Very odd. It must just be a glitch with my
particular setup, because if this was common I'm sure we would be hearing
alot of yelling about this.
I don't know much about graphics cards, but my display settings tell me
this:
Screen resolution at 1680 X 1050 @ 60 Hz, 32 bit Color Quality setting, ATI
Mobility Radeon X1600, 128 MB memory size.
 

Re:Amazing Window Flickering

Quote
DoubleBuffered = true does not help. I also installed the hotfixes, and
this does not help either. Very odd. It must just be a glitch with my
particular setup, because if this was common I'm sure we would be hearing
alot of yelling about this.
No it is not a glitch particular to you. If you speak of the
flickering of the XP-themed gradient background to the TPageControl,
then I see the same thing here with a nVidia card and the latest
drivers.
The difference is before BDS 2006 the TPageControl did not draw the
gradient background of the XP theme. Now it does and I agree it
flickers like crazy when redrawn on a window resize.
Frankly, I think the Win32 API for the XP theme additions is a
grafted-on abomination of programming. It is highly obfuscated in the
way it is controlled within the Win32 API. It bit me as well in a
dialog where I placed a custom control of my own design on that same
gradient background. I found no way to control the flicker since you
can't easily draw that background yourself to match the gradient, nor
could I find a simple way to cache it for my own double-buffering.
The workaround would be to make the TPageControl a fixed size.
---
Michael McCulloch
 

Re:Amazing Window Flickering

Now you made me curios enough, to follow the steps reproduce it. Yes it sure
does flicker, even with DoubleBuffered on the form set to true. But After a
few experiments I tried setting the DoubleBuffered property of the
PageControl to true and the flicker went away! (so did the white colour too,
though)
/Palle
 

Re:Amazing Window Flickering

"Palle Meinert" < XXXX@XXXXX.COM >wrote in message
Quote
Now you made me curios enough, to follow the steps reproduce it. Yes it
sure does flicker, even with DoubleBuffered on the form set to true. But
After a few experiments I tried setting the DoubleBuffered property of the
PageControl to true and the flicker went away! (so did the white colour
too, though)
Yep. I also get really bad flicker on a TGroupBox with alClient alignment.
Setting DoubleBuffered on it does NOT remove flicker, and does retain the
theme color and rounded rect.
Borland is undoubtedly using a native Win32 GroupBox here. A GroupBox is
really a Button, and I can't get rid of flicker in a native GroupBox. The
alternative is to roll your own GroupBox and simply use a visual style
wrapper over the UxTheme, and you get the exact appearrance and no flicker
at all. You can use the same approach for a PageControl, but it would be a
real PITA.
 

Re:Amazing Window Flickering

vortic wrote:
Quote
and you get the exact appearrance and no flicker at all. You can use
the same approach for a PageControl, but it would be a real PITA.
MS have said that the pagecontrol control was never meant to be resized
at runtime. I don't recall error seeing a PageControl on a resizeable
dialog from MS.
Let me know if you find one.
--
Compact Framework for Delphi 2006: www.jed-software.com/cf.htm
QualityCentral Windows Client: www.jed-software.com/qc.htm
Visual Forms IDE Add In: www.jed-software.com/vf.htm
 

Re:Amazing Window Flickering

vortic wrote:
Quote
>Try to set the DoubleBuffered property of your form to true and see if
>that changes anything.

DoubleBuffered = true does not help. I also installed the hotfixes, and
this does not help either. Very odd. It must just be a glitch with my
particular setup, because if this was common I'm sure we would be hearing
alot of yelling about this.
I'm running a lot of legacy BCB6 stuff on new hardware and have just set
up a duel screen display. Flickering on one screen not on the other.
This is more of the graphics driver problem, but since Microsoft simple
do not understand hardware there is no standardization for what the
driver SHOULD do :(
--
Lester Caine - G8HFL
-----------------------------
L.S.Caine Electronic Services - home.lsces.co.uk
Model Engineers Digital Workshop -
home.lsces.co.uk/ModelEngineersDigitalWorkshop/
Treasurer - Firebird Foundation Inc. - www.firebirdsql.org/index.php
 

Re:Amazing Window Flickering

Quote
Frankly, I think the Win32 API for the XP theme additions is a
grafted-on abomination of programming. It is highly obfuscated in the
way it is controlled within the Win32 API. It bit me as well in a
dialog where I placed a custom control of my own design on that same
gradient background. I found no way to control the flicker since you
can't easily draw that background yourself to match the gradient
Yes, you can. Use ThemeServices.DrawParentBackground.
Frederik.
 

Re:Amazing Window Flickering

On Tue, 3 Oct 2006 14:29:12 +0200, "Frederik Slijkerman"
< XXXX@XXXXX.COM >wrote:
Quote
>Frankly, I think the Win32 API for the XP theme additions is a
>grafted-on abomination of programming. It is highly obfuscated in the
>way it is controlled within the Win32 API. It bit me as well in a
>dialog where I placed a custom control of my own design on that same
>gradient background. I found no way to control the flicker since you
>can't easily draw that background yourself to match the gradient

Yes, you can. Use ThemeServices.DrawParentBackground.
Searches on "ThemeServices" in Borland BDS Help and MSDN return
nothing. Where is this class hidden in the BDS documentation?
The DrawThemeBackground() function in the Win32 API seems far from
easy to use.
?
---
Michael McCulloch
 

Re:Amazing Window Flickering

"Michael McCulloch" < XXXX@XXXXX.COM >wrote in message
Quote

The DrawThemeBackground() function in the Win32 API seems far from
easy to use.

?
Well, I don't know how to get the background on a TabSheet of a PageControl.
To get the background on a Form, it goes something like this (forgive my
code, as it has been a couple of years since I've done anything
VCL-related):
///
#include<uxtheme.h>
#include<Tmschema.h>
///
void __fastcall TForm1::FormPaint(TObject *Sender){
HWND* myWnd = NULL;
myWnd = (HWND*)Handle;
HTHEME myTheme = NULL;
myTheme = OpenThemeData(NULL,L"TAB");
HDC myHDC = NULL;
myHDC = (HDC)Canvas->Handle;
if( (myWnd != NULL) && (myTheme != NULL) && (myHDC != NULL) ){
RECT myRect = (RECT)ClientRect;
DrawThemeBackground( myTheme, myHDC, TABP_BODY, 1, &myRect, 0 );
}
}
Set your XP theme to Silver, and your form has that funky silver XP theme
background (assuming you are on XP or Vista?).
If you figure out how to get a TabSheet to work, let me know.
 

Re:Amazing Window Flickering

It's er.... not documented :-) It's in Themes.hpp. At least in Delphi 7.
Frederik
"Michael McCulloch" < XXXX@XXXXX.COM >wrote in message
Quote
On Tue, 3 Oct 2006 14:29:12 +0200, "Frederik Slijkerman"
< XXXX@XXXXX.COM >wrote:

>>Frankly, I think the Win32 API for the XP theme additions is a
>>grafted-on abomination of programming. It is highly obfuscated in the
>>way it is controlled within the Win32 API. It bit me as well in a
>>dialog where I placed a custom control of my own design on that same
>>gradient background. I found no way to control the flicker since you
>>can't easily draw that background yourself to match the gradient
>
>Yes, you can. Use ThemeServices.DrawParentBackground.

Searches on "ThemeServices" in Borland BDS Help and MSDN return
nothing. Where is this class hidden in the BDS documentation?

The DrawThemeBackground() function in the Win32 API seems far from
easy to use.

?

---
Michael McCulloch