I am writing a custom control deriving from UserControl. In it are some controls that I want to prevent from being accessible (some textboxes, comboboxes). They are to become available for interacting only when the user clicks an ‘Edit’ button.
I read about KeyPreview but it is only available for forms. I find redirecting all the events to a common handler that checks if editing mode is enabled too much of a hassle.
Is there any way to put another transparent control over the others (Z orderwise), that will intercept all mouse and keypress events but renders the controls normally? Or maybe there is a different solution?
Edit:
I want to receive mouse events on the control that covers the others. I need those for Drag and drop and moving the custom control.
You can write your’s Enabled property in your UserControl and use it.