问题描述
clone(Bitmap,format)编译器说没有重载需要2个参数
Microsoft docs描述了net frameworks 1.2 to的方法(有2个参数) 4.7.2
( [])
我正在使用框架4.5和visual studio 2012 Express
我在互联网上搜索但没有找到任何关于这样的问题的参考
我缺少什么?
我尝试了什么:
我一直无法找到任何方法强制编译器接受方法调用
clone(Bitmap,format) Compiler say there is no overload that takes 2 arguments
Microsoft docs describes the method ( with 2 arguments) for net frameworks 1.2 to 4.7.2
(Bitmap.Clone Method (System.Drawing) | Microsoft Docs[^])
I am using framework 4.5 and visual studio 2012 Express
I have searched the internet but have not found any reference to such a problem
what am i missing?
What I have tried:
I haven't been able to find any way to force the compiler to accept the method call
推荐答案
newImage = ((Bitmap)image).Clone(sRec,PixelFormat.Format16bppArgb1555);
在原始代码中
(位图)image.Clone
你在任何类型的图像上调用Clone方法,你没有在图像转换为Bitmap时调用它。通过添加括号,您将在将图像投射到位图的结果上调用Clone。
In your original code
"(Bitmap)image.Clone"
You are calling the Clone method on whatever type image is, you're not calling it on image cast to Bitmap. By adding the parenthesis you are calling Clone on the result of casting image to Bitmap.
这篇关于位图方法clone(位图,格式)将无法编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!