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

标签 c# java .net image image-processing

我正在手动将代码从 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/

相关文章:

.net - 以编程方式编辑 Web 服务的端点

c# - 在多线程应用程序中使用单例的危险是什么

c# - 实例化和接口(interface)

c# - .NET - 用自定义控件替换现有控件,同时保留原始控件的属性/事件

java - Eclipse Luna JUnit 源位置未找到

java - 如果从实体关系调用 JsonIgnore 属性

.net - 单个进程中可以加载多少个运行时 (CLR)?

c# - 消息大时 WCF 中的错误异常

c# - 将类添加到最后一项

java - El 表情疑惑