开发者

assign bytes to RGB Color

开发者 https://www.devze.com 2023-02-18 01:39 出处:网络
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\"

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 ?


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);
0

精彩评论

暂无评论...
验证码 换一张
取 消