📜  如何允许用户导入图像c#代码示例

📅  最后修改于: 2022-03-11 14:48:47.433000             🧑  作者: Mango

代码示例1
private void cmdBrowser_Click(object sender, EventArgs e)
        {
            OpenFileDialog fileOpen = new OpenFileDialog();
            fileOpen.Title = "Open Image file";
            fileOpen.Filter = "JPG Files (*.jpg)| *.jpg";

            if (fileOpen.ShowDialog() == DialogResult.OK)
            {
                picImage.Image = Image.FromFile(fileOpen.FileName);
            }
            fileOpen.Dispose();
        }