在做读心术的程序,但是用button控件向picturebox里随机加载图片时却报错,图片路径没有指定错。请高手指教。谢谢using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;namespace _111
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} private void button2_Click(object sender, EventArgs e)
{ } private void button1_Click(object sender, EventArgs e)
{
Random rd = new Random();
pictureBox1.Image = System.Drawing.Bitmap.FromFile("E:\\读心术1.1\\icon" + rd.Next(1,40) + " .bmp");
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;namespace _111
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} private void button2_Click(object sender, EventArgs e)
{ } private void button1_Click(object sender, EventArgs e)
{
Random rd = new Random();
pictureBox1.Image = System.Drawing.Bitmap.FromFile("E:\\读心术1.1\\icon" + rd.Next(1,40) + " .bmp");
}
}
}
这样不是一个好的习惯,程序中最好不要出现1.1这样的路经,要不然出现一些问题不好弄的,你改一下路经