Groups | Blog | Home
all groups > dotnet windows forms designtime > november 2005 >

dotnet windows forms designtime : Properties get serialized only then the control gets resized


Montezuma
11/28/2005 10:35:52 AM
Hi,
this looks like a strange behavior.

I have two properties in my custom control whose relative code gets produced
only when i resize manually (and only manually, i mean with the mouse on the
design surface) the control size.

They won't change their value unless i resize manually the control.

Has somebody experienced this ever?

Montezuma

Gabriel Lozano-Morán
11/28/2005 12:25:03 PM
[quoted text, click to view]

As opposite to resizing how? And if you set the size property of the control
in the property grid? What happens?

Gabriel Lozano-Morán

Carlo
11/28/2005 12:48:33 PM
I experienced the same problem.
After a week of tests and searching, It was solved after installing
Framework 1.1 SP1.
So, install Framework 1.1 Service Pack 1.

HTH

Carlo


-------------------------------------------
Carlo, MCP (Windows Based Applications)
carlodevREMOVE@gmail.com


"Montezuma" <montezuma@ccc.com> ha scritto nel messaggio
news:OcmBZ8$8FHA.3760@TK2MSFTNGP14.phx.gbl...
[quoted text, click to view]

Montezuma
11/28/2005 4:00:21 PM
Thanks a lot.

[quoted text, click to view]

Cristian Balcanu
11/29/2005 12:00:00 AM
I think that those properties should be changed programatically using
TypeDescriptor and PropertyDescriptor (because you posted the question on
this news-group I guess is something about design time).

[quoted text, click to view]

jokiz
12/2/2005 1:17:48 AM
the designer was not notified of the changes made, probably your
properties are dependent on others and you changed it through code
without notifying the designer, christian is correct. since the
designer was notifies of the size change (on resize), he tries to
serialize the changes. designer does not serialize code when it does
not sense a change.
Montezuma
12/26/2005 2:37:44 PM
Hi guys,
thanks for your answers, they led me quickly to the solution (ok, i have
not been working for a while on it).

One needs simply to invoke the "OnComponentChanging" and the
"OnComponentChanged" method provided by the IComponentChangeService.

So:

***
IComponentChangeService c =
(IComponentChangeService)GetService(typeof(IComponentChangeService));

c.OnComponentChanging(yourComponent, null);
yourComponent.someProperty = false;
c.OnComponentChanged(yourComponent, null, null, null);
***

This will notify the designer of the change made on yourComponent.

Have fun.
Montezuma

jokiz ha scritto:
[quoted text, click to view]
AddThis Social Bookmark Button