private void InitializePrintPreviewControl()
{
this._ppreview = new ICS.Client.Controls.PrintPreview();
//
// _ppreview
//
this._ppreview.AutoScroll = true;
this._ppreview.BackColor = System.Drawing.SystemColors.Window;
this._ppreview.Cursor = System.Windows.Forms.Cursors.Default;
this._ppreview.Dock = System.Windows.Forms.DockStyle.Fill;
this._ppreview.Location = new System.Drawing.Point(0, 0);
this._ppreview.Name = "_ppreview";
this._ppreview.Size = new System.Drawing.Size(592, 432);
this._ppreview.ImagePreview.Document = _docToPrint;
this._ppreview.TabIndex = 0;
this._docToPrint.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this .doc_PrintPage);
this._ppreview.UpdatePreview += new PrintSettingsModified(_ppreview_UpdatePreview);
this.ImageEditor_Fill_Panel.Controls.Add(this._ppr eview);
}
This code works perfectly fine just like it is.
But the problem is When a user presses the button to switch between
landscape and portrait, the UpdatePreview eventhandler is called, which
has code like this:
this._docToPrint.DefaultPageSettings.Landscape = true or false;
when this code is run, the control state does not change. i have tried
everything to update the printpreviewcontrol with the new landscape or
portrait setting, but nothing has worked.
I called invalidate(), removed the event handler for PrintPage, changed
the landscape property, and then reattached the event handler for
PrintPage, it still does not work.
I'll appreciate any help.
Basically what I am trying to do is, when by default, PrintPreview shows
the document in portrait, user can press the button to swtich between
Portrait and Landscape.
Thanks
Ali