I want to create a color using the property r,g,b but unfortunately Visual Studio says r is a readonly value. Please help.
Dim newcolor As Color
newcolor.R = vermelho
newcolor.G = verde
newcolor.B = azul
You can't if this is the System.Drawing.Color
struct.
If you look at the reference source for Color.R
, you will see there is not a backing field for you to set. Unless of course you manipulate the Value
, but then you may as well just declare a new Color each time you need to update it.
public byte R
{
get
{
return(byte)((Value >> ARGBRedShift) & 0xFF);
}
}
You'll have to use the shared method FromArgb.
Or in your case