c#如何OpenFileDialog按钮上传图片到PictureBox
已写按钮代码stringfilepath="";OpenFileDialogfileName=newOpenFileDialog();fileName.InitialDi...
已写按钮代码
string filepath = "";
OpenFileDialog fileName = new OpenFileDialog ();
fileName.InitialDirectory = Application.StartupPath;
if (fileName.ShowDialog() == DialogResult.OK)
filepath = fileName.FileName; 展开
string filepath = "";
OpenFileDialog fileName = new OpenFileDialog ();
fileName.InitialDirectory = Application.StartupPath;
if (fileName.ShowDialog() == DialogResult.OK)
filepath = fileName.FileName; 展开
1个回答
推荐于2016-08-10 · 知道合伙人软件行家
关注
展开全部
OpenFileDialog fd = new OpenFileDialog();
fd.Filter = "jpg|*.jpg";
if(fd.ShowDialog()== System.Windows.Forms.DialogResult.OK)
{
this.pictureBox1.ImageLocation = fd.FileName;
}
fd.Filter = "jpg|*.jpg";
if(fd.ShowDialog()== System.Windows.Forms.DialogResult.OK)
{
this.pictureBox1.ImageLocation = fd.FileName;
}
更多追问追答
追问
图片显示不出来啊、
追答
你换个图片试试,有的图片好象是不能显示的。
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询