C#中打开图片
来源:互联网 发布:刀剑神域源码记录下载 编辑:程序博客网 时间:2024/04/30 17:26
private void btnOpen_Click(object sender, EventArgs e)
{
OpenFileDialog ofdPic = new OpenFileDialog();
ofdPic.Filter = "JPG(*.JPG;*.JPEG);gif文件(*.GIF)|*.jpg;*.jpeg;*.gif";
ofdPic.FilterIndex = 1;
ofdPic.RestoreDirectory = true;
ofdPic.FileName = "";
if (ofdPic.ShowDialog() == DialogResult.OK)
{
string sPicPaht = ofdPic.FileName.ToString();
FileInfo fiPicInfo = new FileInfo(sPicPaht);
long lPicLong = fiPicInfo.Length / 1024;
string sPicName = fiPicInfo.Name;
string sPicDirectory = fiPicInfo.Directory.ToString();
string sPicDirectoryPath = fiPicInfo.DirectoryName;
Bitmap bmPic = new Bitmap(sPicPaht);
if (lPicLong > 400)
{
MessageBox.Show("此文件大小為" + lPicLong + "K;已超過最大限制的K范圍!");
}
else
{
Point ptLoction = new Point(bmPic.Size);
if (ptLoction.X > pictureBox_xingzuo.Size.Width || ptLoction.Y > pictureBox_xingzuo.Size.Height)
{
pictureBox_xingzuo.SizeMode = PictureBoxSizeMode.Zoom;
}
else
{
pictureBox_xingzuo.SizeMode = PictureBoxSizeMode.CenterImage;
}
}
pictureBox_xingzuo.LoadAsync(sPicPaht);
//lblName.Text = sPicName;
//lblLength.Text = lPicLong.ToString() + " KB";
//lblSize.Text = bmPic.Size.Width.ToString() + "×" + bmPic.Size.Height.ToString();
}
}
- C#中打开图片
- C# 从硬盘托图片在picturebox中打开
- c#打开图片,用picturebox打开
- 直接拉入图片文件到程序窗口中打开的C#程序
- c# 中释放打开图片和 子窗体调用父窗体函数
- C# 调用画图工具打开图片
- c#中打开视频,word
- c#程序中打开资源管理
- C#中图片操作
- C#中图片透明
- C#调用Windows图片和传真查看器打开图片
- C#调用Windows图片和传真查看器打开图片
- C#打开系统图片查看器查看图片
- C#调用电脑的默认图片浏览器软件打开图片
- [转]C#使用Window图片查看器打开图片
- android中打开相机、打开相册进行图片的获取
- 从SD卡中打开,保存图片
- Win10下eclipse中打开图片乱码
- system调用总是返回-1
- Blackberry 6,7 java环境下开发页面之Field 图片按钮
- 经典SQL行列转换
- c 正则匹配简单运用
- SQL别名、Oracle字符串处理
- C#中打开图片
- 由于之前的分页链接url不规范,导致百度爬虫搜索到死链接
- Oracle redo undo
- 解决“引入JS文件IE6报错”的问题
- 搞不来
- 使用java 发送https 协议请求
- 照顾孩子
- Python应用访问国内Azure站点
- Oracle table-lock的5种模式