作者热门文章
- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我正在手动将代码从 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/
我正在手动将代码从 Java 转换为 C#,但我不知道如何转换 private static int rosu = Color.Red.getRGB; 我收到这个错误: 'System.Drawing
我是一名优秀的程序员,十分优秀!