我必须使用 WinForms 在 VS2008 .net 3.5 中遵循代码:
byte percent = 70;
byte zero = 0;
Bitmap copy = (Bitmap)image1.Clone();
...
Color oColor = copy.GetPixel(x, y);
byte oR = (byte)(oColor.R - percent < zero ? zero : oColor.R - percent);
当我将“ (byte)”从最后一行代码中删除时,我收到一个编译器错误,提示“无法将类型 ' int'隐式转换为 ' ' byte”。如果一切都是类型byte并且byte是整数类型......那我为什么需要演员?