如何从相框中获取图片尺寸 [英] How Do I Get Picture Size From A Picture Box

查看:83
本文介绍了如何从相框中获取图片尺寸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我想在图片框控件中显示图像的大小,我在网上找到的几个例子都是使用openfile对话框控件,但是我没有上传图片,它已经在图片框中了,我试过这个:



Hello everyone, i want to diplay the size of an image in a picturebox control, a few examples i have found online are using openfile dialog control, but i am not uploading the picture, it is already in the picture box, i have tried this:

Image img = Image.FromFile(openDialog.FileName);
double fileWidth = img.Width;
double fileheigth = img.Height;
double fileByte = (((fileWidth) * (fileheigth))/1024);
label2.Text = "Image Size: " + fileByte.ToString() + " KB";





但它似乎不起作用,我将感激任何帮助。在此先感谢



But it doesn't seem to work, please i will appreciate any assitance. Thanks in advance

推荐答案

这篇关于如何从相框中获取图片尺寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆