Winform-图片上传
1.界面上拖個.pictureBox(pictureBox1)
//上傳點擊按鈕
private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog fileDialog = new OpenFileDialog();
DialogResult result = fileDialog.ShowDialog();
if (result == DialogResult.OK)
{
this.pictureBox1.Image = Image.FromFile(fileDialog.FileName);
}
}
//清楚圖片按鈕
private void button2_Click(object sender, EventArgs e)
{
this.pictureBox1.Image = null;
}
C#--程序背景圖片設(shè)置
public Form1()
{
InitializeComponent();
this.pictureBox1.BackgroundImage = Image.FromFile(@"C:\Users\admin\Desktop\logo.png");
this.BackgroundImageLayout = ImageLayout.Stretch;//自動伸展
}
轉(zhuǎn)載于:https://www.cnblogs.com/macT/p/9288936.html
總結(jié)
以上是生活随笔為你收集整理的Winform-图片上传的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 邮储银行《诗经》主题信用卡怎么样?卡片权
- 下一篇: 轻知 | 为什么全球只有13组根域名服务