Click here to Skip to main content
15,909,051 members
Home / Discussions / C#
   

C#

 
QuestionUndescriptive "Parameter is not valid." error Pin
Lauulauu27-Nov-07 3:11
Lauulauu27-Nov-07 3:11 
Hello all,

I am currently writing a very simple 2D game for school. I have created a Sprite class to display images on a windows form. In the constructor of the Form1 class, I have the following code:

handle = this.CreateGraphics();


handle is a Graphics object.

Then, in the Sprite class, this object is used to draw images to the screen:

public void Draw()
{
    Matrix m = new Matrix();
    m.Rotate(rotation);

    handle.Transform = m;

    handle.DrawImage(bitmap, destination);

    handle.Dispose();
}


However, when I run the code, I get the following error on "handle.Transform = m;":

A first chance exception of type 'System.ArgumentException' occurred in System.Drawing.dll


Commenting out the line for testing just moves the error to "handle.DrawImage(bitmap, destination);".

I've been stuck on this for hours now without any progress. Anyone that can give me a push in the right direction?

Many thanks!
AnswerRe: Undescriptive "Parameter is not valid." error Pin
m@u27-Nov-07 3:43
m@u27-Nov-07 3:43 
GeneralRe: Undescriptive "Parameter is not valid." error Pin
Lauulauu27-Nov-07 3:46
Lauulauu27-Nov-07 3:46 
GeneralRe: Undescriptive "Parameter is not valid." error Pin
m@u27-Nov-07 3:59
m@u27-Nov-07 3:59 
GeneralRe: Undescriptive "Parameter is not valid." error Pin
Lauulauu27-Nov-07 4:09
Lauulauu27-Nov-07 4:09 
GeneralRe: Undescriptive "Parameter is not valid." error Pin
m@u27-Nov-07 5:09
m@u27-Nov-07 5:09 
GeneralRe: Undescriptive "Parameter is not valid." error Pin
Lauulauu27-Nov-07 5:37
Lauulauu27-Nov-07 5:37 
AnswerRe: Undescriptive "Parameter is not valid." error Pin
leppie27-Nov-07 4:15
leppie27-Nov-07 4:15 
GeneralRe: Undescriptive "Parameter is not valid." error Pin
Lauulauu27-Nov-07 4:28
Lauulauu27-Nov-07 4:28 
AnswerRe: Undescriptive "Parameter is not valid." error Pin
Lauulauu27-Nov-07 4:35
Lauulauu27-Nov-07 4:35 
QuestionCreating a Form dynamically in inches Pin
sindhutiwari27-Nov-07 2:45
sindhutiwari27-Nov-07 2:45 
AnswerRe: Creating a Form dynamically in inches Pin
Rich Insley27-Nov-07 5:07
Rich Insley27-Nov-07 5:07 
AnswerRe: Creating a Form dynamically in inches Pin
Pete O'Hanlon27-Nov-07 5:11
mvePete O'Hanlon27-Nov-07 5:11 
GeneralRe: Creating a Form dynamically in inches Pin
Rich Insley27-Nov-07 5:42
Rich Insley27-Nov-07 5:42 
QuestionAccess FireBird Server directly. Pin
Yogi Yang 00727-Nov-07 2:00
Yogi Yang 00727-Nov-07 2:00 
AnswerRe: Access FireBird Server directly. Pin
Vasudevan Deepak Kumar27-Nov-07 2:04
Vasudevan Deepak Kumar27-Nov-07 2:04 
AnswerRe: Access FireBird Server directly. Pin
Mustafa Ismail Mustafa27-Nov-07 3:43
Mustafa Ismail Mustafa27-Nov-07 3:43 
GeneralRe: Access FireBird Server directly. Pin
Yogi Yang 00727-Nov-07 20:51
Yogi Yang 00727-Nov-07 20:51 
GeneralRe: Access FireBird Server directly. Pin
PIEBALDconsult28-Nov-07 3:37
mvePIEBALDconsult28-Nov-07 3:37 
AnswerRe: Access FireBird Server directly. Pin
PIEBALDconsult27-Nov-07 12:39
mvePIEBALDconsult27-Nov-07 12:39 
QuestionConvert .NET Image/Bitmap to DIB Pin
Yogi Yang 00727-Nov-07 1:42
Yogi Yang 00727-Nov-07 1:42 
AnswerRe: Convert .NET Image/Bitmap to DIB Pin
Vasudevan Deepak Kumar27-Nov-07 2:02
Vasudevan Deepak Kumar27-Nov-07 2:02 
AnswerRe: Convert .NET Image/Bitmap to DIB Pin
m@u27-Nov-07 2:40
m@u27-Nov-07 2:40 
Questiongetting client id of textbox in gridview Pin
ShaikhAffi27-Nov-07 1:14
ShaikhAffi27-Nov-07 1:14 
AnswerMultipost Question [Occurence: 2; Frequency: 2 Minutes] Please Ignore Pin
Vasudevan Deepak Kumar27-Nov-07 2:17
Vasudevan Deepak Kumar27-Nov-07 2:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.