现在也实现了显示右对齐了。
发现新的问题如图。用代码写的线显示的粗细不一样,而且线有时候不显示。
有没有解决的办法?
加竖线的方法
Line line = new Line();
line.Name = string.Format("codeLine_{0}", i);
line.AnchorBottom = false;
line.LineStyle = LineStyle.Solid;
line.LineColor = Color.Black;
line.LineWeight = 0.5f;
line.Visible = true;
line.X1 = 0f + i * 0.9f;
line.X2 = 0f + i * 0.9f;
line.Y1 = 1.5f;
line.Y2 = 1.5f + 0.35f;
pageHeader.Controls.Add(line);
加横线的方法
for(int j = 0; j <= dt.Rows.Count; j++)
{
Line line = new Line();
line.Name = string.Format("Lineh_{0}", j);
line.AnchorBottom = false;
line.LineStyle = LineStyle.Solid;
line.LineColor = Color.Black;
line.LineWeight = 0.5f;
line.Visible = true;
line.X1 = 0f + 0.35f * j;
line.X2 = 0.7f * (dt.Columns.Count - 3) + 2.7f;
line.Y1 = 0;
line.Y2 = 0;
detail.Controls.Add(line);
}
什么原因造成的? |