在 C# 应用程序中使用 OpenFileDialog 控件
我确信我以前问过这个问题,但搜索没有任何作用,我完全忘记了如何做到这一点。
我需要一种方法让用户从硬盘驱动器中选择图片并使用该位置将该图片加载到 Image 类中。
我过去曾这样做过,但正如我所说,我不记得我是如何做到的。
我知道您可以将文件类型过滤器应用于 OpenFileDialog。
private void LoadImageToMemory()
{
openFileDialog1.Filter = "JPEG | jpeg";
openFileDialog1.ShowDialog();
}
有什么指导吗?谢谢你!
I'm sure I've asked this question before but searching does nothing and I completely forgot how to do this.
I need a way to have a user choose a picture from their hard drive and load that picture to an Image class using the location.
I've done this in the past, but as I said I can't remember how I did it.
I know you can apply a file type filter to the OpenFileDialog.
private void LoadImageToMemory()
{
openFileDialog1.Filter = "JPEG | jpeg";
openFileDialog1.ShowDialog();
}
Any guidance? Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我想通了!
如果有人有同样的问题,这就是你的做法。
I figured it out!
In case anyone has the same question, this is how you do it.
您是否尝试阅读手册?
。您确实应该在 MSDN 甚至 Google 上寻找此类琐碎的信息,而不是 Stack Overflow。 MSDN 是您的朋友,是.Net 开发人员的编程圣经。
Did you try reading the manual?
. You really should be looking for such trivial info on MSDN or even Gooogle, instead of Stack Overflow. MSDN is your friend, THE programming bible for .Net developers.