如何获得剪贴板图像的高度和宽度?
我需要一个像下面这样的代码;
If My.Computer.Clipboard.ContainsImage Then
MsgBox(Clipboard.Image(1).Height) 'This line is not real code.
MsgBox(Clipboard.Image(1).Width) 'This line is not real code.
End If
我需要图像尺寸,因为我想确定如果我要粘贴正确的图像!
答案 0 :(得分:0)
你可以这样使用Clipboard.GetImage()
:
Dim returnImage As System.Drawing.Image = Nothing
If Clipboard.ContainsImage() Then
returnImage = Clipboard.GetImage()
If returnImage.Height != WantedImageHeight || returnImage.Width != WantedImageWidth Then
MsgBox('The image is not correct')
End If
End If
答案 1 :(得分:0)
if (Clipboard.ContainsImage())
{
System.Drawing.Image tempImg = Clipboard.GetImage();
int widthOfImg = tempImg.Width;
int heightOfImg = tempImg.Height;
}