You don't really need the
EventHandler
you can just replaceboardButtons[x, y].Click += click;
withboardButtons[x, y].Click += btn_Click;
. This is called anonymous event handler. The+=
already works with delegates and kinda does that for you.The only time you want to have
this
is when your method parameters have the same names as your class variables it appears that's not case for you, because I don't see any of the variables used without it.
Overall I really don't see what you can improve, you are simply assigning some values to some variables which really cant be speed up. Windows forms isn't really good for many controls at once that's it.