• 00
  • :
  • 00
  • :
  • 00

点击按钮选择图片代码

private void button1_Click(object sender, EventArgs e)
{
    using (OpenFileDialog openFileDialog = new OpenFileDialog())
    {
        openFileDialog.Filter = "All Image Files|*.bmp;*.ico;*.gif;*.jpeg;*.jpg;*.png;*.tif;*.tiff|" +
                "Windows Bitmap(*.bmp)|*.bmp|" +
                "Windows Icon(*.ico)|*.ico|" +
                "Graphics Interchange Format (*.gif)|(*.gif)|" +
                "JPEG File Interchange Format (*.jpg)|*.jpg;*.jpeg|" +
                "Portable Network Graphics (*.png)|*.png|" +
                "Tag Image File Format (*.tif)|*.tif;*.tiff";

        if (DialogResult.OK == openFileDialog.ShowDialog(this))
        {
            textBox1.Text = openFileDialog.FileName;
        }
    }
}

 

posted @ 2020-05-09 09:55  Garson_Zhang  阅读(580)  评论(0编辑  收藏  举报