Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

GDI problem

  • 23-02-2007 11:59PM
    #1
    Moderators, Education Moderators, Technology & Internet Moderators Posts: 35,260 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