例如 现在要开发一个asp.net自定义控件,类似Image控件,有一个ImageUrl属性,编辑器中设定一个图片路径,后要求设计时呈现该图片,现在要获取图片的width和height,
int[] ImageWidthHeight = new int[2];
if (File.Exists(FilePath))
{
System.Drawing.Image imgPhoto = System.Drawing.Image.FromFile(FilePath);
ImageWidthHeight[0] = imgPhoto.Width;
ImageWidthHeight[1] = imgPhoto.Height;
}
现在需要获取图片文件的物理路径,在ControlDesigner中该怎样写?
int[] ImageWidthHeight = new int[2];
if (File.Exists(FilePath))
{
System.Drawing.Image imgPhoto = System.Drawing.Image.FromFile(FilePath);
ImageWidthHeight[0] = imgPhoto.Width;
ImageWidthHeight[1] = imgPhoto.Height;
}
现在需要获取图片文件的物理路径,在ControlDesigner中该怎样写?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货