Specify Double-Click event for a Control in Visual Studio Designer

前端 未结 2 543
南方客
南方客 2020-12-31 14:38

When you Double-Click on a Control in the Visual Studio Designer, you automatically subscribe to some event and an Event Handler is generated in th

2条回答
  •  梦谈多话
    2020-12-31 14:58

    If wanting to do this in the editor.
    For VS2017 (and beyond I suspect). In Designer:

    • Select the control on the form
    • In the Properties Window, select the Events icon
    • The list of available events for that control will be shown
    • Double-click the name of the desired event.

    This also works for deleting the auto-generated code. Remove the name of the event handler for that event. It will get removed from the *.designer.cs file. Note that you still need to remove the handler code in the form source.

提交回复
热议问题