其他分享
首页 > 其他分享> > 点击按钮选择图片代码

点击按钮选择图片代码

作者:互联网

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;
        }
    }
}

 

标签:ico,Format,代码,bmp,jpg,gif,点击,openFileDialog,按钮
来源: https://www.cnblogs.com/GarsonZhang/p/12855464.html