Hello,
I have a weird problem while displaying my image in "detail" section.
I have a specific routine to display my images in a column mode.
I pick up all data via a Web Service.
I display correctly information in the header section.
So when it comes to display pictures in the detail section here it bugs. For example if my dataset returns 2 images or more, i can see my orginal images duplicated many times.
Example 1 (with 1 image):
Image1 --> It works fine with one image
Example 2 (with 2 images):
Image1 Image2
Image1 Image2 --> here's the error. These images shoudln't be displayed
Example 3 (with 3 images):
Image1 Image2 Image3
Image1 Image2 Image3 --> here's the error. These images shoudln't be displayed
Image1 Image2 Image3 --> here's the error. These images shoudln't be displayed also!
Any help would be appreciated
Thank you
Paul
Here's my code:
namespace
PO_Tracking_Report.Production
{
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using Telerik.Reporting;
using Telerik.Reporting.Drawing;
using System.Data;
/// <summary>
/// Summary description for Report1.
/// </summary>
public partial class rptSpecsHeader : Telerik.Reporting.Report
{
private
int _SpecsHeaderId;
private int _RevisionNumber;
private int _NumberOfColumn;
public int SpecsHeaderId
{
get
{
return _SpecsHeaderId;
}
set
{
_SpecsHeaderId =
value;
}
}
public int RevisionNumber
{
get
{
return _RevisionNumber;
}
set
{
_RevisionNumber =
value;
}
}
public int NumberOfColumn
{
get
{
return _NumberOfColumn;
}
set
{
_NumberOfColumn =
value;
}
}
public
void ExecuteReport()
{
// -----------------------------------------------------------------------------------
// Specs Header & Color
// -----------------------------------------------------------------------------------
DataSet ds = new DataSet();
PO_Tracking_WS.
Service v_service = new PO_Tracking_WS.Service();
ds = v_service.GetProductionSpecsColor(
this.SpecsHeaderId, this.RevisionNumber);
this.DataSource = ds;
float v_max_width = 50;
float v_space_x = 10;
float v_space_y = 10;
float v_position_x = 0;
float v_position_y = 0;
this.UnitOfMeasure = UnitType.Pixel;
this.txtSpecsColorId.Visible = true;
int v_counter = 0;
foreach (DataRow dataRow in ds.Tables[0].Rows)
{
v_counter = v_counter + 1;
this.txtSpecsColorId.Value = "Number of images = " + v_counter.ToString();
Telerik.Reporting.
PictureBox v_picture = new Telerik.Reporting.PictureBox();
v_picture.Sizing = Telerik.Reporting.Drawing.
ImageSizeMode.AutoSize;
v_picture.Value = dataRow[
"Path"].ToString();
v_picture.Visible =
true;
v_picture.Left = (Telerik.Reporting.Drawing.Unit.Pixel(v_position_x));
v_picture.Top = (Telerik.Reporting.Drawing.
Unit.Pixel(v_position_y));
if ((v_position_x + v_picture.Width.Value + v_picture.Left.Value) <= v_max_width)
{
v_position_x = v_space_x + v_picture.Width.Value + v_picture.Left.Value;
v_position_y = v_position_y;
}
else
{
v_position_x = 0;
v_position_y = v_space_y + v_picture.Height.Value + v_picture.Top.Value;
}
detail.Items.Add(v_picture);
}
}
public rptSpecsHeader()
{
/// <summary>
/// Required for telerik Reporting designer support
/// </summary>
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
// Only for test
this.NumberOfColumn = 3;
this.RevisionNumber = -1;
this.SpecsHeaderId = 13083;
this.ExecuteReport();
}
}
}