Resolved MDI Child Paints on desktop

aaaron

Well-known member
Joined
Jan 23, 2011
Messages
216
Programming Experience
10+
I have a MDI form with a few child forms on it.

The followig is true for all of them.

When I run it whichever child is active paints on the MDI as it should.

But in Designer mode what I see is a dotted line boundary on the Designer's surface that appers to be correc size.

And the child form displayed on the desktop.

I can grab the child form and drag it.

If I change the value of size in the properties, the display on the desktop changes accordingly.
then the dotted outine also changes accordingly.

The child form contains a usercontrol which normally has a context menu.

In the design mode the menu seems to work.

For example I've used it to paste text into the usercontrol.

I tried adding a button to see if I could. That did not work.

If you can make sense out of this I'd appreciate hearig about it.



P.S. While I was typing ths I noticed the spell checker was not alerting me of misspellings.
 
Solution
I suspect that that's the issue. It really ought to be the parent form that assigns itself to that property when it creates the child forms. Change that and I suspect that it will work.

Failing that, you may be able to check whether it's design time and not set the property in that case. That may not be easy in your configuration and it would definitely be my second choice anyway.
Untitled 1.jpg
Untitled 2.jpg
 
First image: note the Srart Debugging is not grayed. That is, I not running the code.

Second image: shows the context menu works.

By clicknig menu items I've cause zoom and open image files to work, so the .vb file s being used.

And menu events are being raised. Actually in the usercontrol (which is the Red area) which has the context menu.

Also, if the solution was actually running, the form would be enclosed in a mdi window.


Why isn't spell checking working for me??
 
Last edited:
It looks like you're using VS 2022. I suspect that that is a bug in the WinForms designer. Are you targeting .NET 6? If not, what is the target framework? If it's .NET Framework 4.8 or earlier then I'm very surprised. If it's .NET Core (.NET 5 and 6 are based on .NET Core) then you're using a new version of the designer that was built from the ground up and is more likely to have bugs.
 
Yes, in MyBase.OnLoad(e)

They all inherit from a class defined in another file in the same project
 
Last edited:
I suspect that that's the issue. It really ought to be the parent form that assigns itself to that property when it creates the child forms. Change that and I suspect that it will work.

Failing that, you may be able to check whether it's design time and not set the property in that case. That may not be easy in your configuration and it would definitely be my second choice anyway.
 
Solution
Back
Top