你好,按照以下操作顺序试一下:
1、清除以下代码
- private void RPT_ReportStart(object sender, EventArgs e)
- {
- this.picture1.Image = Image.FromFile(Application.StartupPath + @"/ProductsImages/");
- }
复制代码 2、将picture1.DataField清空
3、给Detail添加Format事件,同时添加以下代码
- private void detail_Format(object sender, EventArgs e)
- {
- string path = Application.StartupPath + @"\ProductsImages\" + this.Fields["item_pic"].Value;
- if (System.IO.File.Exists(path))
- {
- this.picture1.Image = Image.FromFile(path);
- }
- else
- {
- // ... ...
- }
- }
复制代码 4、在if (System.IO.File.Exists(path))处添加一个断点,查看path的值 |