PrintPreviewControl problem...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • djpaul
    New Member
    • Oct 2006
    • 137

    PrintPreviewControl problem...

    Hello,
    I have a problem with the printpreviewcon trol under windows 7.
    It only occures under windows 7 not xp.
    I start a new form with the PrintPreviewCon tol on it and a PrintDocument.
    In this case, everything goes perfect.
    But when i add the PrintDocument to the PrintPreviewCon trol it goes wrong (PrintPreviewCo ntrol1.Document = PrintDocument1)

    Any idea where this comes from?
    Thanks!
    Paul
  • djpaul
    New Member
    • Oct 2006
    • 137

    #2
    Anybody any idea, please?

    Comment

    • Joseph Martell
      Recognized Expert New Member
      • Jan 2010
      • 198

      #3
      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?

      Comment

      • djpaul
        New Member
        • Oct 2006
        • 137

        #4
        Hello,
        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.IntUns afeNativeMethod s.IntDeleteDC(H andleRef hDC)
        at System.Drawing. Internal.IntUns afeNativeMethod s.DeleteHDC(Han dleRef hDC)
        at System.Drawing. Internal.Device Context.Dispose (Boolean disposing)
        at System.Drawing. Internal.Device Context.Dispose ()
        at System.Drawing. Printing.Previe wPrintControlle r.OnEndPrint(Pr intDocument document, PrintEventArgs e)
        at System.Windows. Forms.PrintCont rollerWithStatu sDialog.OnEndPr int(PrintDocume nt document, PrintEventArgs e)
        at System.Drawing. Printing.PrintC ontroller.Print (PrintDocument document)
        at System.Drawing. Printing.PrintD ocument.Print()
        at System.Windows. Forms.PrintPrev iewControl.Comp utePreview()
        at System.Windows. Forms.PrintPrev iewControl.Calc ulatePageInfo()
        at System.Windows. Forms.Control.I nvokeMarshaledC allbackDo(Threa dMethodEntry tme)
        at System.Windows. Forms.Control.I nvokeMarshaledC allbackHelper(O bject obj)
        at System.Threadin g.ExecutionCont ext.runTryCode( Object userData)
        at System.Runtime. CompilerService s.RuntimeHelper s.ExecuteCodeWi thGuaranteedCle anup(TryCode code, CleanupCode backoutCode, Object userData)
        at System.Threadin g.ExecutionCont ext.RunInternal (ExecutionConte xt executionContex t, ContextCallback callback, Object state)
        at System.Threadin g.ExecutionCont ext.Run(Executi onContext executionContex t, ContextCallback callback, Object state)
        at System.Windows. Forms.Control.I nvokeMarshaledC allback(ThreadM ethodEntry tme)
        at System.Windows. Forms.Control.I nvokeMarshaledC allbacks()
        at System.Windows. Forms.Control.W ndProc(Message& m)
        at System.Windows. Forms.PrintPrev iewControl.WndP roc(Message& m)
        at System.Windows. Forms.Control.C ontrolNativeWin dow.OnMessage(M essage& m)
        at System.Windows. Forms.Control.C ontrolNativeWin dow.WndProc(Mes sage& m)
        at System.Windows. Forms.NativeWin dow.DebuggableC allback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
        at System.Windows. Forms.UnsafeNat iveMethods.Disp atchMessageW(MS G& msg)
        at System.Windows. Forms.Applicati on.ComponentMan ager.System.Win dows.Forms.Unsa feNativeMethods .IMsoComponentM anager.FPushMes sageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
        at System.Windows. Forms.Applicati on.ThreadContex t.RunMessageLoo pInner(Int32 reason, ApplicationCont ext context)
        at System.Windows. Forms.Applicati on.ThreadContex t.RunMessageLoo p(Int32 reason, ApplicationCont ext context)
        at System.Windows. Forms.Applicati on.Run(Applicat ionContext context)
        at Microsoft.Visua lBasic.Applicat ionServices.Win dowsFormsApplic ationBase.OnRun ()
        at Microsoft.Visua lBasic.Applicat ionServices.Win dowsFormsApplic ationBase.DoApp licationModel()
        at Microsoft.Visua lBasic.Applicat ionServices.Win dowsFormsApplic ationBase.Run(S tring[] commandLine)
        at TestApplication .My.MyApplicati on.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.v b:line 81
        at System.AppDomai n._nExecuteAsse mbly(Assembly assembly, String[] args)
        at System.AppDomai n.ExecuteAssemb ly(String assemblyFile, Evidence assemblySecurit y, String[] args)
        at Microsoft.Visua lStudio.Hosting Process.HostPro c.RunUsersAssem bly()
        at System.Threadin g.ThreadHelper. ThreadStart_Con text(Object state)
        at System.Threadin g.ExecutionCont ext.Run(Executi onContext executionContex t, ContextCallback callback, Object state)
        at System.Threadin g.ThreadHelper. ThreadStart()

        Does this help you more?
        Regards,
        Paul

        Comment

        Working...