Int rosu = Color.red.getRGB () from Java to C #

I manually convert code from Java to C #, and I don't know how to convert

private static int rosu = Color.Red.getRGB;

I get this error:

 'System.Drawing.Color' does not contain a definition for 'getRGB' and no extension method 'getRGB' accepting a first argument of type 'System.Drawing.Color' could be found (are you missing a using directive or an assembly reference?) 

I am using rosu declared in this context:

  for (uy=0;uy<h;uy++) for (ux=0;ux<w;ux++) if(curba[uy][ux]==255) curba[uy][ux]=rosu; 

thanks

+4
source share
1 answer

Is this what you want:

 private static int rosu = Color.Red.ToArgb(); 

The .Net Color class is in any case similar to the wrapper around int , so in your conversion you can instead change all your color variables from int to Color .

+2
source

Source: https://habr.com/ru/post/1336644/


All Articles