找回密码
 立即注册

QQ登录

只需一步,快速开始

gahyyai

中级会员

3

主题

29

帖子

918

积分

中级会员

积分
918

活字格认证

最新发帖
gahyyai
中级会员   /  发表于:2011-6-15 16:01  /   查看:19666  /  回复:37
vs2005,用activereport 3.0,在detail显示商品列表时,如何绑定图片字段,注图片字段是路径(路径+名称)格式的

37 个回复

正序浏览
ZenosZeng讲师达人认证 悬赏达人认证
超级版主   /  发表于:2011-6-16 17:26:00
38#

回复 37# gahyyai 的帖子

你真棒,也可以使用以下代码

  1.             string path = System.Windows.Forms.Application.StartupPath + @"\ProductsImages\" + rpt.Fields["item_pic"].Value;

  2.             if (System.IO.File.Exists(path))
  3.             {
  4.                 ((Picture)rpt.Sections["detail"].Controls["picture1"]).Image = Image.FromFile(path);
  5.             }
  6.             else
  7.             {
  8.                 // ... ...
  9.             }
复制代码
回复 使用道具 举报
gahyyai
中级会员   /  发表于:2011-6-16 17:21:00
37#
自己搞定了,方法如下:
public void Detail_Format()
{
     string path = System.Windows.Forms.Application.StartupPath + @"\ProductsImages\" + rpt.Fields["item_pic"].Value;
     Section sec = rpt.Sections["Detail"];
     Picture picture=sec.Controls[&quoticture1"] as Picture;//注意Picture1大小写
     if (System.IO.File.Exists(path))
     {
         //Picture1.Image=System.Drawing.Image.FromFile(path);
         picture.Image = System.Drawing.Image.FromFile(path);
     }
}
回复 使用道具 举报
gahyyai
中级会员   /  发表于:2011-6-16 16:33:00
36#

designer自定义报表

designer自定义报表

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复 使用道具 举报
ZenosZeng讲师达人认证 悬赏达人认证
超级版主   /  发表于:2011-6-16 16:15:00
35#
你是说的ActiveReports 的 End User Desinger进行自定义报表设计吗,我这里没有ActiveReports3的环境,截一个你使用的Desinger的图给我吧
回复 使用道具 举报
gahyyai
中级会员   /  发表于:2011-6-16 16:08:00
34#
我用的是designer控件自定义报表的,你的这个方法不可行
string path = System.Windows.Forms.Application.StartupPath + @"\ProductsImages\" + rpt.Fields["item_pic"].Value;



        if (System.IO.File.Exists(path))

        {

                this.picture1.Image = System.Drawing.Image.FromFile(path);

        }
回复 使用道具 举报
ZenosZeng讲师达人认证 悬赏达人认证
超级版主   /  发表于:2011-6-16 15:51:00
33#
在报表设计视图的Script视图中,选择 detail 和 Format 将会自动添加一个方法 detail_Format,然后将以下代码添加到该方法中

  1.         string path = System.Windows.Forms.Application.StartupPath + @"\ProductsImages\" + rpt.Fields["item_pic"].Value;

  2.         if (System.IO.File.Exists(path))
  3.         {
  4.                 this.picture1.Image = System.Drawing.Image.FromFile(path);
  5.         }
复制代码

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复 使用道具 举报
gahyyai
中级会员   /  发表于:2011-6-16 14:52:00
32#
public void Detail_Format()
{
           string path = System.Windows.Forms.Application.StartupPath + @"\ProductsImages\" + rpt.Fields["item_pic"].Value;
            if (System.IO.File.Exists(path))
            {
                picture1.Image=Image.FromFile(path);
            }
}
直接不显示报表内容了,去掉上面的代码可以显示报表内容(除图片外)
回复 使用道具 举报
ZenosZeng讲师达人认证 悬赏达人认证
超级版主   /  发表于:2011-6-16 14:41:00
31#
在报表设计视图的Script中添加以下代码

  1. public void detail_Format()
  2. {
  3.         string path = System.Windows.Forms.Application.StartupPath + @"\ProductsImages\" + rpt.Fields["item_pic"].Value;

  4.         if (System.IO.File.Exists(path))
  5.         {
  6.                 this.picture1.Image = System.Drawing.Image.FromFile(path);
  7.         }
  8.         else
  9.         {
  10.                 // ... ...
  11.         }
  12. }
复制代码
回复 使用道具 举报
gahyyai
中级会员   /  发表于:2011-6-16 14:24:00
30#
同样存的是图片名,路径也是和上面一样的。生成的.rpx文件中如何绑定图片呢
回复 使用道具 举报
1234下一页
您需要登录后才可以回帖 登录 | 立即注册
返回顶部