本文介绍了以编程方式在Crystal报表中移动Line对象时发生错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
strNAme = ds.Tables("report").Rows(i).Item("LabelName")
Dim Line As LineObject = DirectCast(rpt.ReportDefinition.ReportObjects(strNAme), LineObject)
Line.Left = ds.Tables("report").Rows(i).Item("Align_Left")' ERROR IS HERE
Line.Top = ds.Tables("report").Rows(i).Item("Align_Top")
Line.Right = ds.Tables("report").Rows(i).Item("Align_Right")
Line.Bottom = ds.Tables("report").Rows(i).Item("Align_Bottom")
我在
上出错Line.Left
捕获了System.Runtime.InteropServices.COMException
ErrorCode = -2147213284
Message =线对象的坐标无效.仅支持垂直或水平线."
i am getting error on
Line.Left
System.Runtime.InteropServices.COMException was caught
ErrorCode=-2147213284
Message="The line object''s coordinates are not valid. Only vertical or horizontal lines are supported."
推荐答案
if (Hline)
{
//Hline. set left and right = left you want
lineObj.Left = Twip.PixelToTwipX(this.X1);
lineObj.Right = lineObj.Left;
//set top and bottom = top you want
lineObj.Top = Twip.PixelToTwipY(this.Y1);
lineObj.Bottom = lineObj.Top;
//set right
lineObj.Right = Twip.PixelToTwipX(this.X2);
}
else
{
//My language
//đường dọc. cho top và bottom bằng top mong muốn
lineObj.Top = Twip.PixelToTwipY(this.Y1);
lineObj.Bottom = lineObj.Top;
//Đổi left = right = left mong muốn
lineObj.Left = Twip.PixelToTwipX(this.X1);
lineObj.Right = lineObj.Left;
//Đổi bottom
lineObj.Bottom = Twip.PixelToTwipX(this.Y2);
}
这篇关于以编程方式在Crystal报表中移动Line对象时发生错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!