我有一份开发快报。我想在报告中搜索所有控件。
Windows窗体中的正常会话将是:
foreach (Control c in Control.ControlCollection)
{
........
}
不幸的是,这在Dev Express表单中不起作用。任何解决方案?
由于
答案 0 :(得分:2)
有很多关于在报告中查找控件或在鼠标上突出显示单元格等问题。
xrLabel1.Text = ((XRLabel)((XtraReport)xrSubreport1.ReportSource).FindControl("xrLabel1", false)).Text;
subreport control - 点击此处附带的示例
How can set the text of a label on a Subreport?
检查此代码段以了解您的功能..
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
报告有一些结构,你可以在GridView中找到特定容器的控件。例如在editTemplate中找到控件..控件的特定容器
检查这些链接可获得更多相关信息:
Loop thru controls of Report or find all visible strings
Find TableCell Controls inside a report
Find all databound controls on report