Groups | Blog | Home
all groups > dotnet windows forms designtime > december 2004 >

dotnet windows forms designtime : Reliable way to determine after all properties were set?



WXS
12/9/2004 7:57:03 PM
Is there a reliable place where I can do some work after all of the
properties have been set?

Controls/Components that need to know when all properties have been set
need to use ISupportInitialize BeginInit, EndInit and use the EndInit call
BUT Begin and EndInit are never called when the component is first dropped on
to the form, making this an unreliable method to use for design mode.

Thanks,
WXS
12/10/2004 12:55:05 PM
It seems Begin/EndInit was for this purpose but does not work the first time
the control is dropped on the form (Which it should). My object is a
component that sits on the form so can't use the form load as I may not be
the one writing the form, someone may just drop my component on their form.
I need to see after all properties are set if there are any
properties/components. that are no longer relevant that I can clean up. I
keep references in the properties that match up to names of other components
in the component list. I remove unreferenced components I add once I can
confirm they are no longer needed. I could do this as the user edits things
but that could be time consuming compared to on designer load the user would
hardly even notice.



[quoted text, click to view]
joeycalisay
12/10/2004 4:17:57 PM
What exactly are you trying to do?

The OnLoad eventhandler of the Form is the only way I can think where you
can do some routine after the execution of the InitializeComponent where all
properties of controls used are set. DesignMode is frequently used as test
at this virtual method.

[quoted text, click to view]

joeycalisay
12/13/2004 9:50:53 AM
Have you tried the OnCreateControl for Control types or the OnLoad for
UserControl types?

[quoted text, click to view]

AddThis Social Bookmark Button