How to enable ALL controls on a form?

前端 未结 5 562
清歌不尽
清歌不尽 2021-01-03 00:08

Currently I have most of my form\'s controls disabled at launch because you cannot use them until a file is loaded. However, once the file is loaded the controls should beco

5条回答
  •  抹茶落季
    2021-01-03 00:30

    Do this:

    var Enable = (Control c) =>
                 {
                     c.Enabled = true;
                     if(c.Controls != null)
                         foreach(Control c2 in c.Controls)
                             Enable(c2);
                 }
    
    Enable(YourForm);
    

提交回复
热议问题