Let me be more precise. In my winforms project, I create classes to manage / create each part of the program. I did this to have more control over my code. For instance. I have a class that controls my DataGridView control. I called it gridManager and set all the properties, colors, etc. in it, and also I have methods for changing these parameters (for example, changeBackgroundColor (), etc.). I also have a class of this type for each panel in splitContainer. In these classes, I initialize each control that is a child of the panel and add them to this panel, setting all the properties, etc.
I wrote everything to give you a better overview for the purpose of these classes.
Now my question is: is it good to make these classes static? When are all controls and methods in a static state?
At first I had non-static ones, but when I wanted to call methods for (for example) changing colors from the Form options, I had to either pass MainForm as a parameter or do it like this:
(Application.OpenForm[0] as MainForm).gridManager.changeColor();
The static version makes this a lot easier. But that makes me wonder if this is good. I explain a lot that I hope that my not perfect English will not become even more difficult to understand. :)
source share