开发者

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

开发者 https://www.devze.com 2023-02-06 00:31 出处:网络
I am converting by hand a code from Java to C#, and I don\'t know how to convert private static int rosu = Color.Red.getRGB;

I am converting by hand a 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 contai开发者_如何学Cn 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 use the declared rosu in this context:

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

Thank you


This is what you want:

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

The .Net Color class is basically just a wrapper around int anyway, so in your conversion you may want to instead change all your color variables from int to Color.

0

精彩评论

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