Event Handler performance

前端 未结 4 522
礼貌的吻别
礼貌的吻别 2021-02-04 08:59

I have a performance problem. I create 100 new buttons and I want to assign an Click Event Handler. I execute this code for about 100 times:

Buttons[i].Button.Cl         


        
4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-04 09:47

    I tried this:-

      public partial class Form1 : Form
      {
        List

    All the buttons appear and the events seem to fire correctly, the event handler assignment is too fast to measure sensibly. Far less than a second on my machine.

    Perhaps the problem lies elsewhere?

提交回复
热议问题