[英]Image in picturebox by image path url
在文本框中輸入/鍵入url后,如何在Winform中顯示圖像? 下面的方法適用於瀏覽圖像,然后它將出現在組合框中,還有其他方法嗎? 由於我已經搜索了多個,所以無法正常工作
OpenFileDialog OpenFd = new OpenFileDialog();
OpenFd.Filter = "Images only. |*.jpg; *.jpeg; *.png; *.gif;";
DialogResult dr = OpenFd.ShowDialog();
pictureBox2.Image = Image.FromFile(OpenFd.FileName);
textBox1.Text = OpenFd.FileName;
private void yourTextBox_TextChanged(object sender, EventArgs e)
{
if (System.IO.File.Exists(yourTextBox.Text))
pictureBox.Image = Image.FromFile(yourTextBox.Text);
}
使用TextBox的TextChanged事件
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.