A bug in opacity processing and MDI forms 
Author Message
 A bug in opacity processing and MDI forms

I think that I have found a bug in the .NET framework regarding opacity and
MDI forms. It is very simple to replicate, and happens when coded in C# and
VB, so I am sure it's a framework bug.

To replicate the problem, create a project that has Form1 as its start up
object. Make Form1 an MDI parent form and make it maximise upon load (for
convenience). Add a second for (Form2) to the project. In Form1's code add
the following Load event handler.

private Form2 mChildForm;

private void Form1_Load(object sender, System.EventArgs e)

{

Opacity = 0.0;

mChildForm = new Form2();

mChildForm.MdiParent = this;

mChildForm.Show();

Opacity = 1.0;

Quote:
}

Then all you need to do is run the application and then move the MDI child
window. As you move the child window, it does not draw. The only time it
will draw correctly is when you move it to the edge of the MDI parent.

Has anyone else seen this, and is there a workaround?

Regards,
Niall.
--
Niall Quiggin
Senior Software Engineer
X-Tek Systems Limited



Mon, 23 May 2005 17:34:22 GMT  
 A bug in opacity processing and MDI forms


Quote:
> I think that I have found a bug in the .NET framework regarding opacity and
> MDI forms. It is very simple to replicate, and happens when coded in C# and
> VB, so I am sure it's a framework bug.

It's a windows issue.  Opacity only works for toplevel windows (MDI
children are not toplevel windows).  See:

http://discuss.develop.com/archives/wa.exe?A2=ind0203D&L=DOTNET&P=R28494

--
Patrick Steele
Microsoft .NET MVP
http://radio.weblogs.com/0110109



Tue, 24 May 2005 03:48:12 GMT  
 A bug in opacity processing and MDI forms
Thanks for the answer, but it is not quite the problem to which I was
referring. What I did was alter the opacity of the MDI parent, and then
restore it. Then when the MDI child windows are moved, they disappear. Try
it. If you wish I have a small example project. What is more you just need
to alter the opacity of the MDI parent to get the effect, restoring it to
100% is not vital. I still maintain that I have found a bug. Does anyone
know of a workaround?

Regards,
Niall.



Quote:


> > I think that I have found a bug in the .NET framework regarding opacity
and
> > MDI forms. It is very simple to replicate, and happens when coded in C#
and
> > VB, so I am sure it's a framework bug.

> It's a windows issue.  Opacity only works for toplevel windows (MDI
> children are not toplevel windows).  See:

> http://discuss.develop.com/archives/wa.exe?A2=ind0203D&L=DOTNET&P=R28494

> --
> Patrick Steele
> Microsoft .NET MVP
> http://radio.weblogs.com/0110109



Tue, 24 May 2005 18:34:43 GMT  
 A bug in opacity processing and MDI forms
Hi, Niall

I tried your sample and duplicated the problem.  This isn't the first
painting problem I have seen with using Opacity / Transparency with
WinForms.  I can't offer you any work around ideas until I know what you
are trying to do.  Based on what you have provided so far, you could just
set the visible property to False and back to True.

Please get back to me with more details.

Thanks,

John Eikanger
Microsoft Visual Basic Team

This posting is provided AS IS with no warranties, and confers no rights.
(c) 2002 Microsoft Corporation.  All rights reserved.

--------------------



| Subject: Re: A bug in opacity processing and MDI forms
| Date: Fri, 6 Dec 2002 10:34:43 -0000
| Lines: 32
| X-Tomcat-NG: microsoft.public.dotnet.languages.vb
|
| Thanks for the answer, but it is not quite the problem to which I was
| referring. What I did was alter the opacity of the MDI parent, and then
| restore it. Then when the MDI child windows are moved, they disappear. Try
| it. If you wish I have a small example project. What is more you just need
| to alter the opacity of the MDI parent to get the effect, restoring it to
| 100% is not vital. I still maintain that I have found a bug. Does anyone
| know of a workaround?
|
| Regards,
| Niall.
|




| > > I think that I have found a bug in the .NET framework regarding
opacity
| and
| > > MDI forms. It is very simple to replicate, and happens when coded in
C#
| and
| > > VB, so I am sure it's a framework bug.
| >
| > It's a windows issue.  Opacity only works for toplevel windows (MDI
| > children are not toplevel windows).  See:
| >
| > http://discuss.develop.com/archives/wa.exe?A2=ind0203D&L=DOTNET&P=R28494
| >
| > --
| > Patrick Steele
| > Microsoft .NET MVP
| > http://radio.weblogs.com/0110109
|
|
|



Wed, 25 May 2005 01:21:01 GMT  
 A bug in opacity processing and MDI forms
What I was doing was trying to improve the visual effect of loading our MDI
application. Upon loading the MDI parent window, a number of MDI child
windows are created. In the creation of these windows, their initialisation
code can take some tme. What is more I have created a class that repositions
and resizes the MDI child windows to the last positions and sizes. This
class is connected to the window's load event. So what was happening was
that upon the load event of the MDI parent window I had the code to create,
initialise and reposition the MDI child windows. You cannot set the MDI
parent's visibility property to false in the load event handler as this only
puts the code into an infinite loop trying to update the visibility. So I
thought that I would try to make the MDI parent window totally transparent
whilst the load event handler function was being executed. This work fine,
but then you cannot move the MDI child windows without them disappearing.

What I have done is to move the code that creates and initialises the MDI
child windows into the constructor of the MDI parent window. This works
fine, but I have a preference for simple constructor functions as error
handling is much easier when an object is fully constructed. Is there a
better solution?

Regards,
Niall.

--
Niall Quiggin
Software Engineering
X-Tek Systems Limited



Quote:
> Hi, Niall

> I tried your sample and duplicated the problem.  This isn't the first
> painting problem I have seen with using Opacity / Transparency with
> WinForms.  I can't offer you any work around ideas until I know what you
> are trying to do.  Based on what you have provided so far, you could just
> set the visible property to False and back to True.

> Please get back to me with more details.

> Thanks,

> John Eikanger
> Microsoft Visual Basic Team

> This posting is provided "AS IS" with no warranties, and confers no
rights.
> (c) 2002 Microsoft Corporation.  All rights reserved.



Fri, 27 May 2005 18:41:14 GMT  
 A bug in opacity processing and MDI forms
Hi, Niall

I don't see a better way to do this either.  Most people use a splash
screen to hide their manipulations.

Sorry I could not provide a better solution for you,

John Eikanger
Microsoft Visual Basic Team

This posting is provided AS IS with no warranties, and confers no rights.
(c) 2002 Microsoft Corporation.  All rights reserved.
--------------------

| Newsgroups: microsoft.public.dotnet.languages.vb
| Subject: Re: A bug in opacity processing and MDI forms
| Date: Mon, 9 Dec 2002 10:41:14 -0000
| Lines: 52
| X-Tomcat-NG: microsoft.public.dotnet.languages.vb
|
| What I was doing was trying to improve the visual effect of loading our
MDI
| application. Upon loading the MDI parent window, a number of MDI child
| windows are created. In the creation of these windows, their
initialisation
| code can take some tme. What is more I have created a class that
repositions
| and resizes the MDI child windows to the last positions and sizes. This
| class is connected to the window's load event. So what was happening was
| that upon the load event of the MDI parent window I had the code to
create,
| initialise and reposition the MDI child windows. You cannot set the MDI
| parent's visibility property to false in the load event handler as this
only
| puts the code into an infinite loop trying to update the visibility. So I
| thought that I would try to make the MDI parent window totally transparent
| whilst the load event handler function was being executed. This work fine,
| but then you cannot move the MDI child windows without them disappearing.
|
| What I have done is to move the code that creates and initialises the MDI
| child windows into the constructor of the MDI parent window. This works
| fine, but I have a preference for simple constructor functions as error
| handling is much easier when an object is fully constructed. Is there a
| better solution?
|
| Regards,
| Niall.
|
| --
| Niall Quiggin
| Software Engineering
| X-Tek Systems Limited
|


| > Hi, Niall
| >
| > I tried your sample and duplicated the problem.  This isn't the first
| > painting problem I have seen with using Opacity / Transparency with
| > WinForms.  I can't offer you any work around ideas until I know what you
| > are trying to do.  Based on what you have provided so far, you could
just
| > set the visible property to False and back to True.
| >
| > Please get back to me with more details.
| >
| > Thanks,
| >
| > John Eikanger
| > Microsoft Visual Basic Team
| >
| > This posting is provided "AS IS" with no warranties, and confers no
| rights.
| > (c) 2002 Microsoft Corporation.  All rights reserved.
| >
|
|
|
|



Sat, 28 May 2005 08:38:27 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. mdi child opacity?

2. Q: Form activate Fires On Non Child MDI Forms But Only Once On Child Mdi Forms

3. Forcing Out-of-Process MDI Child Form --HOW??

4. BUGS in MDI Children forms

5. ****ANYONE EXPERIENCE BUG WITH MAX WIN95 MDI CHILD FORM??***

6. HELP: BUG: Maximized Win95 MDI Child Form Disappears

7. VB Bug? - Menu Items when using MDI Form

8. MDI Form BUG!!

9. MDI Form BUG!!

10. Dialogs, MDI forms and a VB Bug?

11. Modifying object in MDI Parent form from MDI Child form

12. Non-MDI form to MDI form

 

 
Powered by phpBB® Forum Software