图片路径的选择
private void button3_Click(object sender, System.EventArgs e)
{
if(this.openFileDialog1.ShowDialog()==DialogResult.OK)
{
if(File.Exists(this.openFileDialog1.FileName))
{
this.textBox1.Text=this.openFileDialog1.FileName;
filepath=this.textBox1.Text;
this.pictureBox1.Image=new Bitmap(this.textBox1.Text);
}
else
{
MessageBox.Show("无文件!");
}
}
图片路径的付与
private void button1_Click(object sender, System.EventArgs e)
{
if(filepath=="")
{
MessageBox.Show("ertet");
}
else
{
this.Close();
}
}