gpt4 book ai didi

c# - int rosu=Color.red.getRGB() 从 Java 到 C#

转载 作者:搜寻专家 更新时间:2023-11-01 03:29:18 25 4
gpt4 key购买 nike

我正在手动将代码从 Java 转换为 C#,但我不知道如何转换

private static int rosu = Color.Red.getRGB;

我收到这个错误:

'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?)

我在此上下文中使用声明的 rosu:

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

谢谢

最佳答案

这就是你想要的:

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

无论如何,.Net Color 类基本上只是 int 的包装器,因此在您的转换中,您可能希望从 int 更改所有颜色变量Color

关于c# - int rosu=Color.red.getRGB() 从 Java 到 C#,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4772291/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com