我想从openfile对话框中获取图像并在程序中使用它 我想更改此代码并从openfiledialog获取图像,我该怎么办?
string pathToImage = @"test1.gif";
pathToImage = AppDomain.CurrentDomain.BaseDirectory + pathToImage;
//Try extracting the frames
frames = EnumerateFrames(pathToImage);
if (frames == null || frames.Count() == 0)
答案 0 :(得分:0)
尝试以下代码,它将为您提供图像的路径
OpenFileDialog openFileDialog = new OpenFileDialog();
DialogResult dialogResult = openFileDialog.ShowDialog();
if (dialogResult == DialogResult.OK)
{
this.pathToImage = System.IO.Path.GetFullPath(openFileDialog.FileName);
}