ReportViewer Display Mode question


V

Voivod

Hi,
just a simple question... I've a report (rdlc) inside a reportviewer,
and i'd like to catch a sort of "DisplayModeChanged" event, but the
ReportViewer doesn't have this kind of event.
So I was trying to figure out an alternative way...

Basically I need to set a parameter to a X value when the report
display mode is set to "Print preview" (and to an Y value when the
report is displayed in normal mode).

Any ideas?
Thank you very much
 
Ad

Advertisements

V

Voivod

Hi,
just a simple question... I've a report (rdlc) inside a reportviewer,
and i'd like to catch a sort of "DisplayModeChanged" event, but the
ReportViewer doesn't have this kind of event.
So I was trying to figure out an alternative way...

Basically I need to set a parameter to a X value when the report
display mode is set to "Print preview" (and to an Y value when the
report is displayed in normal mode).

Any ideas?
Thank you very much

After a little of work I found a way to to this... Basically i go
through the Controls collection of the ReportViewer and find the one
named "printPreview", and then i handle the "click" event:

foreach (Control ct in reportViewer.Controls)
{
foreach (Control ct1 in ct.Controls)
{
foreach (Control ct2 in ct1.Controls)
{
if (ct2.Name == "reportToolBar")
{
foreach (Control ct3 in ct2.Controls)
{
if (ct3.Name == "toolStrip1")
{
ToolStrip ts = (ToolStrip)ct3;
foreach (ToolStripItem itm in ts.Items)
{
if (itm.Name == "printPreview")
{
itm.Click += new EventHandler(itm_Click);
}
}
}
}
}
}
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top