private int ConvertColorToRGB(Color col) { return (col.R) | (col.G << 8) | (col.B << 16); }If you are using VB.NET, it still has an RGB function to call or:
Public Function ConvertColorToRGB(col As Color) As Integer
Return CInt(col.R) Or (CInt(col.G) << 8) Or (CInt(col.B) << 16)
End Function
1 comment:
Nice and easy - thanks for the tip. It makes a nice extension method too (e.g. ToRgb())
Post a Comment