0

I have added a control inside a control and i want to avoid the basic behavior of the inner control.

Is there any options available to avoid the basic behaviors like Border drawing while hovering, clicking a button etc for the inner control to be added inside a control?

EG: Added a button inside a UserControl and wants to avoid the basic functionalities of button like click.

Could anyone please let me know, how to proceed on this?

Regards, Amal Raj U.

Amal
  • 576
  • 1
  • 6
  • 26
  • you can `disable` inner control. – Darshan Faldu Apr 17 '17 at 05:51
  • @DarshanPatel - is there any option available without disabling, since while disabling the control is just rendered like image? – Amal Apr 17 '17 at 07:29
  • You can handle inner control events and implement what you need. Currently the question is too general. If you need a more specific answer, please ask a more specific question and consider asking [mcve]. – Reza Aghaei Apr 17 '17 at 09:51
  • @RezaAghaei - Refer to the eg in the edit. I just wanted to avoid the basic behaviors. – Amal Apr 18 '17 at 03:57
  • What's the meaning of "Avoid button click"? Does it mean "Preventing visual effect of click"? Does it mean "Prevent button from running its click event handler logic"? Or something else? Please describe more about the requirement, then we can think about using overriding or using NativeWindow or something else :) – Reza Aghaei Apr 18 '17 at 08:56
  • @RezaAghaei - Need to prevent visual effect of clicking, hovering on button and other actions and event performance like click event handling – Amal Apr 18 '17 at 08:58
  • And what's the difference of such behavior and disabling the control? Is there any difference? In the case which you described the button should act like a drawing without any other behavior. – Reza Aghaei Apr 18 '17 at 09:01
  • if disabled, then the button will be rendered as dull gray or like just a image. the appearance of the control should not be changed. – Amal Apr 18 '17 at 09:09
  • As an option you can put a transparent overlay over your user control using a `TransparentPanel`. I've used such technique in [this example](http://stackoverflow.com/a/40209045/3110834). The user can only have interaction with the transparent panel but not controls. In the example I've decided to draw something on transparent panel based on user click, but controls doesn't receive click. It's a small example, but its the same way which windows forms designer works at design time. The controls which you see at design time, are real controls and are not disabled but they don't receive click. – Reza Aghaei Apr 18 '17 at 11:13

0 Answers0