MDI form with Menu assigned through IDesignerHost wouldn't refresh

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I tried to assign a MainMenu to a MDIForm from the ControlDesigner class. It
actually work when I click on the MDIIForm's border after I assigned it. If I
don't do the "clicking on the MDIForm's border", the MainMenu will never
appear whether or not I save the Solution/Projects. I am quite confirm it is
assigned because I tried to retrieved back the MainMenu from the MDIForm.

How can I actually make it refresh/update so that the MainMenu appear? I
even tried hostingForm.Container.Components).Refresh() and
hostingForm.Container.Components).Update()

Thanks in advance for the help,
-
 
Hi again,

I further test on the MainMenu that assigned to the MDIForm and found that
even after I do the "clicking on the MDIForm's border" and save the
Solution/Projects and when the next time I launch the same project again, the
MDIForm.Menu is still null and not assigned with the MainMenu. Can anyone
help explain this?

Thanks
 
Just some clarifications, how are you assigning the MainMenu to the Form and
whose ControlDesigner class is making this assignment?

I can sense that the MainMenu component is available at designtime and you
want it to be only used by the Form for a certain scenario and perhaps it is
dependent on a control with the said designer class. Whenever a designer
class modifies any of the components, they need to broadcast the change and
notify IComponentChangeService by utilitizing the RaiseComponentChanging and
RaiseComponentChanged methods of the ComponentDesigner class. The affected
properties (like the form's MainMenu) should be passed on the said methods
using their PropertyDescriptors. You can also obtain the MainMenu
propertyDescriptor and use its SetValue method which will automatically
notify IComponentChangeService so the changes will be serialized if it is
configured to do so.

TypeDescriptor.GetProperties(myObject)["MyPropertyName"].Set­Value(myObject,
myNewValue);

See also related post entitled: Refreshing in Designer

--
Joey Calisay
http://spaces.msn.com/members/joeycalisay/



ALWIZ New said:
Hi again,

I further test on the MainMenu that assigned to the MDIForm and found that
even after I do the "clicking on the MDIForm's border" and save the
Solution/Projects and when the next time I launch the same project again, the
MDIForm.Menu is still null and not assigned with the MainMenu. Can anyone
help explain this?

Thanks

ALWIZ New said:
Hi,

I tried to assign a MainMenu to a MDIForm from the ControlDesigner class. It
actually work when I click on the MDIIForm's border after I assigned it. If I
don't do the "clicking on the MDIForm's border", the MainMenu will never
appear whether or not I save the Solution/Projects. I am quite confirm it is
assigned because I tried to retrieved back the MainMenu from the MDIForm.

How can I actually make it refresh/update so that the MainMenu appear? I
even tried hostingForm.Container.Components).Refresh() and
hostingForm.Container.Components).Update()

Thanks in advance for the help,
-
 
Hi joeycalisay,

Appreciate for your help. Its all make sense now. Do you have any
recommendation on books to refer for Windows.Net Visual Designer? Every
detail and everything about designer?

Thanks again,



joeycalisay said:
Just some clarifications, how are you assigning the MainMenu to the Form and
whose ControlDesigner class is making this assignment?

I can sense that the MainMenu component is available at designtime and you
want it to be only used by the Form for a certain scenario and perhaps it is
dependent on a control with the said designer class. Whenever a designer
class modifies any of the components, they need to broadcast the change and
notify IComponentChangeService by utilitizing the RaiseComponentChanging and
RaiseComponentChanged methods of the ComponentDesigner class. The affected
properties (like the form's MainMenu) should be passed on the said methods
using their PropertyDescriptors. You can also obtain the MainMenu
propertyDescriptor and use its SetValue method which will automatically
notify IComponentChangeService so the changes will be serialized if it is
configured to do so.

TypeDescriptor.GetProperties(myObject)["MyPropertyName"].Set­Value(myObject,
myNewValue);

See also related post entitled: Refreshing in Designer

--
Joey Calisay
http://spaces.msn.com/members/joeycalisay/



ALWIZ New said:
Hi again,

I further test on the MainMenu that assigned to the MDIForm and found that
even after I do the "clicking on the MDIForm's border" and save the
Solution/Projects and when the next time I launch the same project again, the
MDIForm.Menu is still null and not assigned with the MainMenu. Can anyone
help explain this?

Thanks

ALWIZ New said:
Hi,

I tried to assign a MainMenu to a MDIForm from the ControlDesigner class. It
actually work when I click on the MDIIForm's border after I assigned it. If I
don't do the "clicking on the MDIForm's border", the MainMenu will never
appear whether or not I save the Solution/Projects. I am quite confirm it is
assigned because I tried to retrieved back the MainMenu from the MDIForm.

How can I actually make it refresh/update so that the MainMenu appear? I
even tried hostingForm.Container.Components).Refresh() and
hostingForm.Container.Components).Update()

Thanks in advance for the help,
-

 
Book:
1. Windows Forms Programming in C# by Chris Sells
with free chapter for design-time integration:
http://www.awprofessional.com/articles/printerfriendly.asp?p=169528
2. Developing .NET Custom Controls and Designers using C# by James Henry
http://www.bluevisionsoftware.com/WebSite/Books.aspx


Links:
http://www.divil.co.uk/net/articles/designers/introduction.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/custdsgnrdotnet.asp
http://windowsforms.net/articles/shapedesigner.aspx




--
Joey Calisay
http://spaces.msn.com/members/joeycalisay/


ALWIZ New said:
Hi joeycalisay,

Appreciate for your help. Its all make sense now. Do you have any
recommendation on books to refer for Windows.Net Visual Designer? Every
detail and everything about designer?

Thanks again,



joeycalisay said:
Just some clarifications, how are you assigning the MainMenu to the Form and
whose ControlDesigner class is making this assignment?

I can sense that the MainMenu component is available at designtime and you
want it to be only used by the Form for a certain scenario and perhaps it is
dependent on a control with the said designer class. Whenever a designer
class modifies any of the components, they need to broadcast the change and
notify IComponentChangeService by utilitizing the RaiseComponentChanging and
RaiseComponentChanged methods of the ComponentDesigner class. The affected
properties (like the form's MainMenu) should be passed on the said methods
using their PropertyDescriptors. You can also obtain the MainMenu
propertyDescriptor and use its SetValue method which will automatically
notify IComponentChangeService so the changes will be serialized if it is
configured to do so.

TypeDescriptor.GetProperties(myObject)["MyPropertyName"].Set­Value(myObject,
myNewValue);

See also related post entitled: Refreshing in Designer

--
Joey Calisay
http://spaces.msn.com/members/joeycalisay/



ALWIZ New said:
Hi again,

I further test on the MainMenu that assigned to the MDIForm and found that
even after I do the "clicking on the MDIForm's border" and save the
Solution/Projects and when the next time I launch the same project
again,
the
MDIForm.Menu is still null and not assigned with the MainMenu. Can anyone
help explain this?

Thanks

:

Hi,

I tried to assign a MainMenu to a MDIForm from the ControlDesigner class. It
actually work when I click on the MDIIForm's border after I assigned
it.
If I
don't do the "clicking on the MDIForm's border", the MainMenu will never
appear whether or not I save the Solution/Projects. I am quite
confirm
it is
assigned because I tried to retrieved back the MainMenu from the MDIForm.

How can I actually make it refresh/update so that the MainMenu appear? I
even tried hostingForm.Container.Components).Refresh() and
hostingForm.Container.Components).Update()

Thanks in advance for the help,
-

 
Back
Top