Hi how to set R G B
values in System.Drawing.Color.G
?
which is like System.Drawing.Color.G=255;
is not allowed because its read o
The Color
structure is immutable (as all structures should really be), meaning that the values of its properties cannot be changed once that particular instance has been created.
Instead, you need to create a new instance of the structure with the property values that you want. Since you want to create a color using its component RGB values, you need to use the FromArgb method:
Color myColor = Color.FromArgb(100, 150, 75);