XRLabel.Angle在运行时

时间:2013-12-10 14:24:46

标签: c# winforms devexpress xtrareport

iam使用DevExpress v.10.2并希望在XtraReport上使用Angle显示XRLabel。如果我使用Designer它工作正常。但现在我想在运行时执行此操作,因为Label.Text是动态的。我的问题是报告没有显示我的标签。我阅读了一些DevExpress支持文章,该文章描述了它只是在处理PDF格式。但就我而言,我只看到一条小灰线。 我试着跟随我的XRLabel填充第一个:

XRLabel druckinfo = new XRLabel();
druckinfo.Text = string.Format("SB{0} {1} EMAIL {2}", _Sachbearbeiter.Sbnr, _Kennung,
                _Sachbearbeiter.Email1); //The values are filled and working.
                druckinfo.Visible = true;
                druckinfo.AutoWidth = false;
                druckinfo.Angle = 90;
                druckinfo.Font = new Font("Arial", 6f);
                band.Controls.Add(druckinfo); //This is the DetailBand where i add other Labels too and its working fine.
                druckinfo.HeightF = 500f; //Setting Height very high, because the text turns and i thought this is working. But seems to have no effect :(
                druckinfo.LocationF = new PointF(400f, 400f);
                druckinfo.Borders = DevExpress.XtraPrinting.BorderSide.All;

如果我删除以下行:

druckinfo.Angle = 90;

标签变得很好但没有角度肯定。

这是一个屏幕截图,显示了PDF上带有顶部设置的标签:

enter image description here 这是我的报告的设置:

 _Report.PaperKind = PaperKind.A4;
 _Report.ReportUnit = ReportUnit.HundredthsOfAnInch;
 _Report.ShowPrintMarginsWarning = false;
 _Report.Margins = new Margins(0, 0, 0, 0);

所有其他属性均为默认值。存在的乐队如下:

PageHeaderBand DetailBand PageFooterBand

问候

1 个答案:

答案 0 :(得分:3)

这似乎正在起作用:)我不确定为什么这会起作用而我的顶级帖子也不行。但我复制了由设计师生成的代码,现在它可以工作。

XRLabel druckinfo = new XRLabel();
druckinfo.Angle = 90F;
druckinfo.Padding = new PaddingInfo(2, 2, 0, 0, 96F);
druckinfo.SizeF = new SizeF(29.16666F, 500F);
druckinfo.Font = new Font("Arial",8f);
druckinfo.Text = text;
_Band.Controls.Add(druckinfo);
druckinfo.LocationF = new PointF(0F, 500F);