Just override the event handler in your class and do not call base(...)
in the overidden event handler:
protected override void OnComponentChanged(
Object component,
MemberDescriptor member,
Object oldValue,
Object newValue
)
{
// now this handler is called instead of the handler of the base
class when
// the ComponentChanged-event occurs
}
Thanks for the response. I wish it were that easy however (or maybe it is
but I'm still mucking around with this stuff). What I've done is download a
component posted by a MSFT blogger which I'm now trying to unravel out so I
can customize it (see here if you're interested
http://blogs.msdn.com/mharsh/archive...4/395304.aspx). His component
allows you to display an arbitrary form in design mode (at runtime) so users
can change it just like programmers do in the VS forms designer (it's really
a mini component that wraps the latter). What basically happens is that you
pass his component an arbitrary form and it does the following:
1) Creates a new (blank) "Form" which encapsulates a "DesignSurface" member
(initializing it accordingly)
2) Copies the form you passed onto the newly created "DesignSurface" (in 1
above)
3) Invokes "DesignSurface.GetService()" to retrieve an
"IComponentChangeService" interface
4) Sets the "ComponentChanging" event on the above interface to capture any
user changes
You can now call "ShowDialog()" on the form created in 1) above and it
displays the form you passed on a design surface just like in the VS form's
designer. You can therefore move and resize all your form's controls just
like in VS. I want to prevent this however. Item 4) above is invoked
whenever the user makes any changes so I can't simply provide an override
(or don't see how at this point but I'm not sure if it's the correct
approach here even if it is doable). Doing nothing in the handler has no
effect BTW as the user's changes are still processed. I'd really just like
to prevent the user from moving/resizing the controls in the first place but
still can't find a way to do it. I think I might have to make the control's
size and locations properties read-only but I've played with this and can't
figure out how to do it. Any additional insight would be welcome though I
realize it may be a lot to swallow if you're not already familir with this
stuff. Thanks.