Removing Click method from Windows form application

后端 未结 2 1279
时光取名叫无心
时光取名叫无心 2021-01-14 06:50

I\'m starting with C# and I went through this tutorial on how to create a simple picture viewer:

http://msdn.microsoft.com/en-us/library/dd492135.aspx

You cr

相关标签:
2条回答
  • 2021-01-14 07:35

    Expand the Node for your "Form1" in the Solution Explorer and doubleclick on the Designer.cs (Form1.Designer.cs). I think there is still a reference to the picturebox1 click event. you need to remove this.

    Anyway, the Designer.cs holds all information about your controls/containers that you add to your form, but you can still overwrite this by create new values in the regular code behind of 'form1'.

    0 讨论(0)
  • 2021-01-14 07:53

    Your form is spread across two files as a partial class. The background 'wiring up' code is in the myform.designer.cs file and your code is in the myform.cs file. If you just delete the handler from your code the wiring-up code will still exist and you will not be able to compile. So you can go into the designer.cs code and delete the relevant code from there as well but probably not advised if you are just starting out.

    The proper thing to do is, in the designer UI, look at the properties of the button (f4) and click the 'events' button across the top bar. You should see your event handler in there somewhere. if you right click in the event handler there is an option to 'reset'. Click that and it will remove the wire up code. If your handler doesn't contain any code then I believe it will also delete that (I haven't got a winfom, project in front of me so cant say for sure).

    0 讨论(0)
提交回复
热议问题