Question

I tried the Visual C# Kicks code for an alpha-blended form. This works (as soon as I remove the TransparencyKey property); that is, I can use the W3C's PNG alpha test image and see other windows underneath, but makes all controls on the form invisible. Presumably, they simply aren't painted, as OnPaint is overridden. I tried calling the superclass's OnPaint:

Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
    UpdateFormDisplay()

    MyBase.OnPaint(e)
End Sub

, but this didn't change anything. (Calling MyBase.OnPaint first doesn't make any difference either.)

Unfortunately most articles about alpha-blended forms focus on pure splash screens without any controls on them — but we need a panel which first shows sign-in fields, then a progress bar.

The controls, by the way, do not need transparency; it's only on the outer edges that the PNG's transparency truly matters. So faking this by adding another form on top of this all (with the two always moving in tandem) might suffice, but I'd prefer a smoother solution.

Was it helpful?

Solution

Strange, anyways, this article covers an alpha transformed form with controls:

http://www.codeproject.com/KB/miscctrl/AlphaForm.aspx

OTHER TIPS

Try putting this in your form ctor after InitializeComponents();

base.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true);

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top