I have a little problem with windows forms in c#.
Let’s keep it simple: I have a method which sets the default background color and foreground color. I have multiple forms from which I want to call it and I want have only one method (keep the possibility to add a default background image, etc… ). How should I do it ?
This is the basic code:
public void LoadGraphics() {
this.BackColor = Graphics.GraphicsSettings.Default.BackgroundColor;
this.ForeColor = Graphics.GraphicsSettings.Default.ForegroundColor;
this.BackgroundImage = new Bitmap(Graphics.GraphicsResources.bg_small);
}
Create a parent class that implements the method and derive your Forms from that parent class: