[英]C# adding image property to controlbox
我的userControl1.cs包含一個文本框和一個圖片框,如何將一個屬性添加到類中,以允許其從url字符串中獲取圖片
這就是我到目前為止
public partial class UserControl1 : UserControl
{
public UserControl1()
{
InitializeComponent();
}
public override string Text
{
get
{
return textBox1.Text;
}
set
{
textBox1.Text = value;
}
}
}
這是添加屬性的方式,
public Image PictureFromWeb { get; set;}
但是有更好的方法
內置的PictureBox.Load(string URL)方法“將ImageLocation設置為指定的URL並顯示指示的圖像。” (自.NetFramework 2起)
引用此答案 -支持他的答案
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.