Is there a way to make a UserControl unfocussable?

前端 未结 6 693
迷失自我
迷失自我 2021-01-04 11:43

Is there a way to make a UserControl unfocussable?

EDIT: So SetStyle(ControlStyles.Selectable, false)

is the way to go. But still there is diffe

6条回答
  •  孤城傲影
    2021-01-04 12:26

    Yes, the SetStyle(ControlStyles.Selectable, false); works only if you are inheriting from a control.

    It will not work, if you are inheriting from a user control.

    To get around the problem, I added a panel to the user control and docked the panel to "Fill". Added rest of the controls to the panel instead of the user control. It worked!

提交回复
热议问题