How to get Clipboard Image's height and width?
I need a code like following;
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
I need image size because I want to be sure that if I will paste correct image!
You can use Clipboard.GetImage()
like so:
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
if (Clipboard.ContainsImage())
{
System.Drawing.Image tempImg = Clipboard.GetImage();
int widthOfImg = tempImg.Width;
int heightOfImg = tempImg.Height;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.