I'd like to find a simpler(and better) way of initializing an element.
Let me take an example of TextBox.
Because of Type conversion and etc. It is quite messy.
The following code is what I have as a solution. I used extension method.
Is Telerik going to provide something similar to this?
// a lot more of TextBoxes ...
Let me take an example of TextBox.
Because of Type conversion and etc. It is quite messy.
The following code is what I have as a solution. I used extension method.
Is Telerik going to provide something similar to this?
double leftPoint = 0;
double Y_FirstLine = 0.02;
double width = 1.25;
double height = 0.25;
Telerik.Reporting.TextBox textBox;
// Add ItemInfoId Box
textBox = new Telerik.Reporting.TextBox();
textBox.SetTextBoxAttribute("ItemId", leftPoint, Y_FirstLine, width, height);
groupHeaderSection1.Items.Add(textBox);
// Add Cost Box
leftPoint += 0.6;
textBox = new Telerik.Reporting.TextBox();
textBox.SetTextBoxAttribute("COST", leftPoint, Y_FirstLine, width, height);
groupHeaderSection1.Items.Add(textBox);
// a lot more of TextBoxes ...
public static class TextBoxExtension
{
public static void SetTextBoxAttribute(
this Telerik.Reporting.TextBox itemBox,
string value, double left, double top, double width, double height)
{
itemBox.Value = value;
itemBox.Location = new Telerik.Reporting.Drawing.PointU(
new Telerik.Reporting.Drawing.Unit(left, Telerik.Reporting.Drawing.UnitType.Inch),
new Telerik.Reporting.Drawing.Unit(top, Telerik.Reporting.Drawing.UnitType.Inch));
itemBox.Size = new Telerik.Reporting.Drawing.SizeU(
new Telerik.Reporting.Drawing.Unit(width, Telerik.Reporting.Drawing.UnitType.Inch),
new Telerik.Reporting.Drawing.Unit(
height, Telerik.Reporting.Drawing.UnitType.Inch));
}
}