【问题标题】:Set Width of XRPictureBox at Runtime在运行时设置 XRPictureBox 的宽度
【发布时间】:2018-08-05 23:01:07
【问题描述】:

我正在创建 devexpress xtrareport 的 xrpicturebox,如下所示。

        if (dtPath.Rows.Count <= 0) return;

        var panelResimler = new XRPanel {Width = 800};

        float x = 0;
        float y = 0;

        for (var i = 0; i < dtPath.Rows.Count; i++)
        {
            XRPictureBox xrPictureBox1 = new XRPictureBox
            {

                ImageUrl = dtPath.Rows[i]["DokumanYolu"].ToString(),
                Sizing = ImageSizeMode.AutoSize,
                Dpi = 100F,
                LocationFloat = new DevExpress.Utils.PointFloat(x, y),
                Name = "xrPictureBox1",
            };

            //if (xrPictureBox1.Width > 800)
            //{
            //    xrPictureBox1.Width = 800;
            //}

            if (xrPictureBox1.Right > 800)
            {
                xrPictureBox1.Left = 0;
            }
            else
            {
                xrPictureBox1.Top = 0;
            }

            if (xrPictureBox1.Bottom > y) y = xrPictureBox1.Bottom;
            x = xrPictureBox1.Right;

            panelResimler.Controls.Add(xrPictureBox1);
        }

        Detail2.Controls.Add(panelResimler);

问题是,当我使用面板时,这里的图像部分不可见,而尺寸不适合报告。顺便说一句,注释掉的部分在这里没有帮助。

如果我不使用面板,则可以使用图像拉伸来分割页面。

是否有任何解决方案可以通过页面宽度限制图像宽度?

这就是我想要的

这是没有面板的

比提前...

【问题讨论】:

  • 从您的描述中不清楚您在做什么:您想显示许多绑定到数据源的图片吗?还是要为单个数据行(单个波段)添加许多图片?
  • @k0st1x 抱歉,我刚刚添加了我想要的图像。我想动态平铺报告内的图像。

标签: winforms devexpress xtrareport


【解决方案1】:

ImageSizeMode.AutoSize 模式不会为控件设置特定的尺寸 - 它将在打印/文档生成过程中得到纠正。所以你不应该查看控件大小(Right 和 Bottom 属性),你可以将图片大小更改为页面大小除以图片数量(如果我正确理解你的场景)并将 PictureBox Sizing 模式设置为 Zoom image或挤压(或类似的东西)。

【讨论】:

    猜你喜欢
    • 2013-10-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-11-05
    • 2012-06-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多