Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

GDI problem

Options
  • 23-02-2007 11:59pm
    #1
    Moderators, Education Moderators, Technology & Internet Moderators Posts: 35,079 Mod ✭✭✭✭


    When ever I run my program I get the following error and the toolbar is replaced with a white box and red X through it. I might be wrong but I bleieve it is something to do with the paint method so I posted up the code for my Paint method. i havn't made any changes to the OnPaint incase any one is wondering.

    Any help on this would be great as it's been doing my nut in for ages.
    
    System.ArgumentException: Parameter is not valid.
       at System.Drawing.Graphics.TranslateClip(Int32 dx, Int32 dy)
       at System.Windows.Forms.Control.PaintTransparentBackground(PaintEventArgs e, Rectangle rectangle, Region transparentRegion)
       at System.Windows.Forms.ToolStrip.EraseCorners(PaintEventArgs e, Region transparentRegion)
       at System.Windows.Forms.ToolStrip.OnPaintBackground(PaintEventArgs e)
       at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
       at System.Windows.Forms.Control.WmPaint(Message& m)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       at System.Windows.Forms.ToolStrip.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
    
    
    Graphics g;
                
                g = e.Graphics;
    
                if (this.Width < this.drawingSurface.Width)
                    this.Width = drawingSurface.Width;
                if (this.Height < drawingSurface.Height)
                    this.Height = drawingSurface.Height;
    
                g.DrawImage(drawingSurface, rectBounds);
                g.Dispose();
    


Advertisement