By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,504 Members | 1,190 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,504 IT Pros & Developers. It's quick & easy.

PrintPreviewControl problem...

P: 137
I have a problem with the printpreviewcontrol under windows 7.
It only occures under windows 7 not xp.
I start a new form with the PrintPreviewContol on it and a PrintDocument.
In this case, everything goes perfect.
But when i add the PrintDocument to the PrintPreviewControl it goes wrong (PrintPreviewControl1.Document = PrintDocument1)

Any idea where this comes from?
Jul 15 '10 #1
Share this Question
Share on Google+
3 Replies

P: 137
Anybody any idea, please?
Jul 27 '10 #2

Joseph Martell
Expert 100+
P: 196
Any more details on what you mean by "it goes wrong"? Are you getting an exception or unexpected output? Are you developing on an XP machine and deploying to a Windows 7 machine, or can you debug the application on the Windows 7 box?
Jul 27 '10 #3

P: 137
First i was developing on a xp system and the program executes with an exeption.
So i developed on the windows 7 a new form and going step by step until it goes wrong.
As it finaly goes wrong, he executes with an exeption:

Attempted to read or write protected memory. This is often an indication that other memory is corrupt

In the stackTrace:
at System.Drawing.Internal.IntUnsafeNativeMethods.Int DeleteDC(HandleRef hDC)
at System.Drawing.Internal.IntUnsafeNativeMethods.Del eteHDC(HandleRef hDC)
at System.Drawing.Internal.DeviceContext.Dispose(Bool ean disposing)
at System.Drawing.Internal.DeviceContext.Dispose()
at System.Drawing.Printing.PreviewPrintController.OnE ndPrint(PrintDocument document, PrintEventArgs e)
at System.Windows.Forms.PrintControllerWithStatusDial og.OnEndPrint(PrintDocument document, PrintEventArgs e)
at System.Drawing.Printing.PrintController.Print(Prin tDocument document)
at System.Drawing.Printing.PrintDocument.Print()
at System.Windows.Forms.PrintPreviewControl.ComputePr eview()
at System.Windows.Forms.PrintPreviewControl.Calculate PageInfo()
at System.Windows.Forms.Control.InvokeMarshaledCallba ckDo(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallba ckHelper(Object obj)
at System.Threading.ExecutionContext.runTryCode(Objec t userData)
at System.Runtime.CompilerServices.RuntimeHelpers.Exe cuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(Exec utionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state)
at System.Windows.Forms.Control.InvokeMarshaledCallba ck(ThreadMethodEntry tme)
at System.Windows.Forms.Control.InvokeMarshaledCallba cks()
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.PrintPreviewControl.WndProc(M essage& m)
at System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchM essageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager. System.Windows.Forms.UnsafeNativeMethods.IMsoCompo nentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.Run MessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.Run MessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationCo ntext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.Run(String[] commandLine)
at TestApplication.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.Run UsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context( Object state)
at System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

Does this help you more?
Jul 27 '10 #4

Post your reply

Sign in to post your reply or Sign up for a free account.