在不知道其名称的情况下手动选择控件的元素...(ReportViewer)
我正在我的 C# 应用程序中使用 ReportViewer 类,并且有一个问题并不需要解决,但我想弄清楚。
假设我启动了一个新表单,其中包含完全停靠的报表查看器控件,当表单加载时,报表查看器已刷新并显示我的报表。
在几乎所有情况下,报告都会比表单的垂直尺寸更长,因此会有垂直滚动条。
我想做的是找出一种方法来为报表查看器控件的“报表区域”部分提供焦点或选择,以便在加载表单时 - 我可以立即使用鼠标上的滚轮向上移动并查看报告。
实际发生的情况是,在我单击报告区域之前,滚动条不起作用。
有谁知道如何关注这一特定领域?
这是我试图重点关注该区域的一些代码...
int x = this._ReportViewer.Location.X + (this._ReportViewer.Width / 2);
int y = this._ReportViewer.Location.Y + (this._ReportViewer.Height / 2);
this._ReportViewer.RenderingComplete += delegate
{
this.OnMouseClick(new MouseEventArgs(MouseButtons.Left, 1, x, y, 1));
};
谢谢!
i am utilising the reportviewer class in my c# application and have a question that isnt essential to fix but something i would like to figure out.
Lets say i launch a new form with a fully docked reportviewer control inside and by the time the form loads the reportviewer has refreshed and is showing my report.
In almost all cases the report will be longer that the vertical size of the form and hence there will be vertical scrollbars.
What i would like to do is figure out a way to give the 'report area' part of the reportviewer control focus or selection so that when the form has loaded - i can immediately use the scroll wheel on my mouse to move up and down the report.
What actually happens is the scroll bars do not work until i click on the report area.
Does any one know how to give that particular area focus?
Here is some of the code i have tried to give that area focus...
int x = this._ReportViewer.Location.X + (this._ReportViewer.Width / 2);
int y = this._ReportViewer.Location.Y + (this._ReportViewer.Height / 2);
this._ReportViewer.RenderingComplete += delegate
{
this.OnMouseClick(new MouseEventArgs(MouseButtons.Left, 1, x, y, 1));
};
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想到的一个想法是递归地循环访问 ReportViewer 控件。点击报告区域后,将焦点设置到该控件上。
这是一个示例片段:
One idea that comes to mind is to loop through the ReportViewer controls recursively. Upon hitting the report area, set focus to that control.
Here is an example snippet: