c# - 当我单击按钮时,OpenFileDialog 冻结应用程序/GUI
问题描述
我已经看到了有关此问题的多个问题并尝试了几种解决方案,但似乎都没有奏效,也许我错过了一些东西。
private void ButtonBrowseProfile_Click(object sender, EventArgs e)
{
using(OpenFileDialog openFileDialog = new OpenFileDialog())
{
openFileDialog.Title = "Upload Profile Image";
openFileDialog.Filter = "Image Files(*.jpg;*.jpeg;*.gif;*.bmp;*.png)|*.jpg;*.jpeg;*.gif;*.bmp;*.png";
if (openFileDialog.ShowDialog() == DialogResult.OK)
pictureBoxProfile.Image = new Bitmap(openFileDialog.FileName);
}
}
对话框不显示,调试应用程序只是冻结并变得不可点击
WinForm,.NET 框架 4.8 | 528040
解决方案
推荐阅读
- vba - GETPROFILESTRING 崩溃
- reactjs - React Router:当我在 URL 栏中输入“/signup”时,它会将我重定向到“/”,但指向“/signup”的链接可以正常工作
- dropbox-api - 您如何在 Dropbox API“下载”请求的路径中指定修订版?
- javascript - 是否可以预取网页音频并提前播放,以便与视频同步?有没有一个javascript命令?
- r - 如何根据其他列中的值将列中的特定值向上移动一行?
- phpword - PhpWord 雷达图,将轴刻度更改为从 0 开始
- html - 自动化错误:“调用的对象已与其客户端断开连接”
- c# - 如何在 C# 中使用像 Office Outlook 桌面一样的应用程序密码
- google-maps - 放大单击具有多个引脚的引脚而不聚集
- powershell - 我的“找不到路径”错误的根源在哪里?(删除-AppxProvisionedPackage)