我如何循环获取详细信息(2个文本框),使第二个文本框严格位于第一个但右对齐的下面。或者如何指示第二个文本框位于第一个但右侧(右对齐)下
example
good name
price
another good
name
price
`public void Goods_BeforePrint()
{
Section sec;
sec = rpt.Sections["Goods"];
for(int y= 0; y <= sec.Controls.Count - 1;y++)
{
if( y%2> 0)
{
sec.Controls[y].Height += sec.Controls[y-1].Height;
((TextBox)sec.Controls[y]).Text = System.Convert.ToString(sec.Controls.Count);
}
}`现在,我在每一行都有0.25的高度值。问题不在于行的大小,而在于行的大小,因为这里没有我所期望的迭代,并且每行的大小都相同。
发布于 2015-02-26 11:22:48
您的问题不是很清楚;但是,根据预期的输出,我建议您处理SubReport的detail部分的Format事件,并访问要更改其对齐方式的控件。因此,如果您希望它左对齐两次,每隔三行右对齐一次,下面的代码应该可以工作:
int counter = 0;
private void detail_Format(object sender, EventArgs e)
{
counter++;
if (counter % 3 == 0)
{
this.txtCountry1.Alignment = GrapeCity.ActiveReports.Document.Section.TextAlignment.Right;
}
else
{
this.txtCountry1.Alignment = GrapeCity.ActiveReports.Document.Section.TextAlignment.Left;
}
}这是来自我的机器的屏幕截图,显示了一个具有类似实现的基本示例。

https://stackoverflow.com/questions/28557524
复制相似问题