kartal
kartal

Reputation: 18086

assign bytes to RGB Color

I tried to assign byte to RGB color but I got this error in VS2010 "Property or indexer 'System.Drawing.Color.R' cannot be assigned to -- it is read only" so how can I assign byte to RGB color ?

Upvotes: 2

Views: 2026

Answers (1)

Snowbear
Snowbear

Reputation: 17274

There is no way to assign this property. Instead you should create new Color instance:

Color oldColor;
byte r;
Color newColor = Color.FromArgb(oldColor.A, r, oldColor.G, oldColor.B);

Upvotes: 3

Related Questions