Rattlerr
Feb 27th, 2006, 03:59 PM
I'm working with a OnPaintBackGround and trying to Catch an PaintEventArgs e ....It has a certain format for its size that i'm trying to change but for now i'm working on Catching the Exception thats Thrown during Debug...
What i'm trying to do is too get the OnPaint onto a Picture Box that i have on my Form
Here is the Code i'm working with just cant figure out what i need to put in past the "catch" part..
protected override void OnPaintBackground(PaintEventArgs e)
{
try
{
// Draw the current background image stretched to fill the full screen
e.Graphics.DrawImage(Backgroundimage[currentImageIndex], 578, 231, Size.Width, Size.Height);
}
catch (FormatException fEx)
{
// This is what i need to fill in to catch the above problem e.Graphics.DrawImage(Backgroundimage[currentImageIndex], and so on
}
I get a "NullReference was UnHandles" it high lights the e.Graphics.DrawImage Line and in the Locals Lists the Following::
-----------------------------------------------------
this Cannot obtain value of local or argument '<this>' as it is not available at this instruction pointer, possibly because it has been optimized away. MediaViewer.Main
-------------------------------------------------
+ e {ClipRectangle = {X=0,Y=0,Width=823,Height=586}} System.Windows.Forms.PaintEventArgs
}
----------------------------------------------------
What i'm trying to do is too get the OnPaint onto a Picture Box that i have on my Form
Here is the Code i'm working with just cant figure out what i need to put in past the "catch" part..
protected override void OnPaintBackground(PaintEventArgs e)
{
try
{
// Draw the current background image stretched to fill the full screen
e.Graphics.DrawImage(Backgroundimage[currentImageIndex], 578, 231, Size.Width, Size.Height);
}
catch (FormatException fEx)
{
// This is what i need to fill in to catch the above problem e.Graphics.DrawImage(Backgroundimage[currentImageIndex], and so on
}
I get a "NullReference was UnHandles" it high lights the e.Graphics.DrawImage Line and in the Locals Lists the Following::
-----------------------------------------------------
this Cannot obtain value of local or argument '<this>' as it is not available at this instruction pointer, possibly because it has been optimized away. MediaViewer.Main
-------------------------------------------------
+ e {ClipRectangle = {X=0,Y=0,Width=823,Height=586}} System.Windows.Forms.PaintEventArgs
}
----------------------------------------------------