上的所有绑定控件
我有一个开发快递报告。我想搜索报表上的所有控件。
windows窗体中的常规转换是:
foreach (Control c in Control.ControlCollection)
{
........
}
不幸的是,这将不工作在Dev Express的形式。有解决方案吗?
谢谢
有很多这样的问题,关于在报告中找到控件或在鼠标上突出显示单元格等。
xrLabel1.Text = ((XRLabel)((XtraReport)xrSubreport1.ReportSource).FindControl("xrLabel1", false)).Text;
子报表控件- 查看此处附带的示例
如何在子报表上设置标签的文本?
检查这段代码片段,对你的功能有一些想法。
Private Sub XtraReport1_BeforePrint(ByVal sender As Object, ByVal e As
System.Drawing.Printing.PrintEventArgs)
Dim collection As XRControlCollection = (CType(CType(sender, DevExpress.XtraReports.UI.XtraReport),
Q274540.XtraReport1)).Detail.Controls
For i As Integer = 0 To collection.Count - 1
If TypeOf collection(i) Is XRLabel Then
If (CType(collection(i), XRLabel)).DataBindings.Count <> 0 Then
'your code here
End If
End If
Next i
End Sub
XRControl。BeforePrint事件
Report有一些结构,你可以在特定的容器中找到控制,就像你在GridView中做的那样。例如,找到控件在editTemplate ..控件
的特定容器查看这些链接获取更多信息:
循环遍历Report控件或查找所有可见字符串
查找报表中的TableCell控件
查找报表