Can I use a .net control parent class to enable/disable it?
问题 I need to write a delegate for a multi-threaded program that will enable/disable a variety of controls. It seems logical that using one handler for all controls would be the best choice, but I'm not even sure this is possible in .net and if so how to implement. 回答1: public void SetControlsEnabled(bool enabled) { // Make sure we're in the correct thread if (InvokeRequired) { // If not, run the method on the UI thread Invoke(new MethodInvoker(() => SetControlsEnabled(enabled))); return; } //