8B2H4R_N9G5M3S7
Fri Jun 08 08:41:01 CDT 2007
No. All I did was set the .NET Windows Form property: TransparencyKey. That
got rid of the flicker but made the window fade SO Much slower. The article
I read stated that this property, when set, forces System.Windows.Forms to
layer the window.
See the last section from this code project article that addresses opacity
and layered windows.
http://www.codeproject.com/csharp/notanotherformfader.asp
--
Brian R.
"Bob Powell [MVP]" wrote:
> Are you directly using the LayeredWindow API?
>
> --
> --
> Bob Powell [MVP]
> Visual C#, System.Drawing
>
> Ramuseco Limited .NET consulting
>
http://www.ramuseco.com
>
> Find great Windows Forms articles in Windows Forms Tips and Tricks
>
http://www.bobpowell.net/tipstricks.htm
>
> Answer those GDI+ questions with the GDI+ FAQ
>
http://www.bobpowell.net/faqmain.htm
>
> All new articles provide code in C# and VB.NET.
> Subscribe to the RSS feeds provided and never miss a new article.
>
>
> "Brian R." <8B2H4R_N9G5M3S7@noemail.nospam> wrote in message
> news:56BB69F8-C45F-4774-88FD-8410C2B981F6@microsoft.com...
> > So how do I disable the OnPaintBackground? I tried overriding
> > OnPaintBackground but it never gets called. I tried setting window styles
> > to
> > UserPaint and AllPaintingInWMPaint, but that didn't make either OnPaint or
> > OnPaintBackground get called.
> >
> > Could this be related to layered windows? I read something about the .NET
> > transition to a layered window has an error that causes flicker. The
> > workaround was to set a transparent key color, which forces .NET to layer
> > the
> > window. This solved the flicker problem, BUT it made the window insanely
> > slow to transition, esepcially when maximized.
> >
> > --
> > Brian R.
> >
> >
> >
> > "Bob Powell [MVP]" wrote:
> >
> >> For almost any reasonably intellient paint scheme one should disable the
> >> OnPaintBackground.
> >>
> >> --
> >> --
> >> Bob Powell [MVP]
> >> Visual C#, System.Drawing
> >>
> >> Ramuseco Limited .NET consulting
> >>
http://www.ramuseco.com
> >>
> >> Find great Windows Forms articles in Windows Forms Tips and Tricks
> >>
http://www.bobpowell.net/tipstricks.htm
> >>
> >> Answer those GDI+ questions with the GDI+ FAQ
> >>
http://www.bobpowell.net/faqmain.htm
> >>
> >> All new articles provide code in C# and VB.NET.
> >> Subscribe to the RSS feeds provided and never miss a new article.
> >>
> >>
> >> "Brian R." <8B2H4R_N9G5M3S7@noemail.nospam> wrote in message
> >> news:4B10049E-5FC0-4942-97DC-4DCDF8445E04@microsoft.com...
> >> > We are trying to use basic windows forms to do "fancy" transitions on
> >> > our
> >> > application. When switching between main form controls (docked to
> >> > full),
> >> > we
> >> > want to make it look like one is fading out and the other fading in.
> >> > Since
> >> > the UserControls don't support 'Opacity' I built a transition panel
> >> > that
> >> > shows a modal form (with internal timer) that fades out, then back in
> >> > when
> >> > the next control is shown. The Transition form is shown over the area
> >> > of
> >> > the
> >> > main form's child controls.
> >> >
> >> > It functions as expected, however when the transition form hits opacity
> >> > 1.0
> >> > (goes from 0 to 1, to 0 again to simulate fading out then back in), I
> >> > get
> >> > a
> >> > flash of black once before it starts to fade back to 0 opacity.
> >> >
> >> > The backcolor and forecolor are set to white. I have overriden
> >> > OnPaintBackground, but it isn't being called. It definitely seems like
> >> > the
> >> > parent is refreshing (because I change the control states of the main
> >> > control
> >> > to visible at the mid fade point) and causing the modal dialog to
> >> > repaint
> >> > black.
> >> >
> >> > If it flashed white, I would be OK with that, but I would prefer it to
> >> > always repaint the current screen. In MFC and C++ I recall that you
> >> > could
> >> > setup the default brush for erasing. Not sure if there is a .NET
> >> > equivalent.
> >> >
> >> > I do have a picture box on the form. Is it possible that it's
> >> > OnPaingBackground is causing the flash?
> >> >
> >> > Any thougths would be helpful. I am sure I am missing some vital step
> >> > here.
> >> >
> >> > --
> >> > Brian R.
> >> >
> >>
> >>
>