index > Installing and Registering Visual Studio Express Editions > PrintPreviewControl still broken in Beta2?

PrintPreviewControl still broken in Beta2?

Just got Beta2 and the printpreviewcontrol still appears not to work. I copied the code directly from the help, but nothing gets displayed on the preview. If I call print, then it prints out correctly, it is just the preview which does not work. Here is the code (straight from MSDN):


// Declare the PrintPreviewControl object and the
// PrintDocument object.
internal PrintPreviewControl PrintPreviewControl1;
private System.Drawing.Printing.PrintDocument docToPrint =
new System.Drawing.Printing.PrintDocument();
private void InitializePrintPreviewControl()
{
// Construct the PrintPreviewControl.
this.PrintPreviewControl1 = new PrintPreviewControl();
// Set location, name, and dock style for PrintPreviewControl1.
this.PrintPreviewControl1.Location = new Point(88, 80);
this.PrintPreviewControl1.Name = "PrintPreviewControl1";
this.PrintPreviewControl1.Dock = DockStyle.Fill;
// Set the Document property to the PrintDocument
// for which the PrintPage event has been handled.
this.PrintPreviewControl1.Document = docToPrint;
// Set the zoom to 25 percent.
this.PrintPreviewControl1.Zoom = 0.25;
// Set the document name. This will show be displayed when
// the document is loading into the control.
this.PrintPreviewControl1.Document.DocumentName = "c:\\someFile";
// Set the UseAntiAlias property to true so fonts are smoothed
// by the operating system.
this.PrintPreviewControl1.UseAntiAlias = true;
// Add the control to the form.
this.Controls.Add(this.PrintPreviewControl1);
// Associate the event-handling method with the
// document's PrintPage event.
this.docToPrint.PrintPage +=
new System.Drawing.Printing.PrintPageEventHandler(
docToPrint_PrintPage);
this.docToPrint.Print();
}
// The PrintPreviewControl will display the document
// by handling the documents PrintPage event
private void docToPrint_PrintPage(
object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
// Insert code to render the page here.
// This code will be called when the control is drawn.
// The following code will render a simple
// message on the document in the control.
string text = "In docToPrint_PrintPage method.";
System.Drawing.Font printFont =
new Font("Arial", 35, FontStyle.Regular);
e.Graphics.DrawString(text, printFont,
Brushes.Black, 10, 10);
}

 


I then called InitializePrintPreviewControl() from a button click event.

Any ideas?
Zaph0d
Post a bug report on the Microsoft Product Feedback Center.


VS Code Analysis Team | My Blog: http://davidkean.net | FxCop Blog: http://blogs.msdn.com/FxCop
David M. Kean
reply 2

You can use google to search for other answers

 

More Articles

• Can't access registration benefits
• Using ODE in 2005 Problems
• Registering....
• VC# 2005 Express - reg key
• Installing C++ Express on a Model Computer to be mirrored.
• can i install visual studio express beside visual studio 2003
• Installing on SP1
• Online search problem with new install of Doc Explorer
• issue regarding registration for express edition in img format
• Download the full version of Web Developer 2005 Express
Bookmark and Share
Welcome to Bokebb   New Update  
 

New Articles

• ER Diagrams
• Visual C++ Express installation problem.
• Registering the Express Versions of C# a
• Visual C++ Express standalone download
• install/uninstall problem resolved - tip
• resize web report viewer control on size
• Reviewer????
• SQL 2005 Express Command Line Install
• Making Visual Studio Project Wizzards
• Repeater Component for VB Studio Express
• Installing Visual Studio 2005 Express Ed
• Is there a place to download the MSDN Be
• Can VC++Express & VS.Net Team Suite,
• Visual Basic vs Delphi
• AspNetAccessProvider missing from Vis.we

Hot Articles

• XP does not boot anymore after trying to
• Getting AdventureWorks sample database t
• Project Types and Templates Gone.
• Error uninstalling VB 2005 Express
• I can't create New Projects Any More !!!
• Solution files that use multiple languages
• Installation of VB
• Registration Benefits
• CD/DVD case image?
• Where are the optimization settings?
• Is there any way to capture the HTML of
• XML Documentation
• Problem with deinstallation of Beta-Vers
• VC# 2005 beta crashing - please help
• Databinding methods such as Eval(), XPat

Recommend Articles

• Access denied Installer 3.1
• Requested Registry Access Is Not Allowed
• How to determine conecction string
• Activation key not working
• How to Create a New Data File?
• problem installing
• Trouble Launching VB 2005 Express Beta 2
• Issue installing Visual Web Developer 20
• MFC in VC++ express beta 2
• VC# New Project button disabled
• Visual Basic Woes - Debugging Error?
• The future of Express Editions
• How do I switch to snap-to-grid in WinFo
• help
• Can't create new project in Visual Basic