restabro
asked on
Error passing PaintEventArgs to functions
My program captures a Paint event then passes the PaintEventArg to several graphics functions to perform various drawing tasks. When I only use one function, the program works. As soon as I try to string more than one function together in the calling function, I get a run time error stating "Invalid Parameter Used". Here is a code sample:
//graphicForm.h=========== ========== ========
void drawPart1(PaintEventArgs * e);
void drawPart2(PaintEventArgs * e);
.....
private: System::Void tabPage1_Paint(System::Obj ect * sender, System::Windows::Forms::Pa intEventAr gs * e)
{
drawPart1(e); //works fine when this is the only call
drawPart2(e); //crashes when I include this one
}
//graphicForm.cpp========= ========== ====
void graphicForm::drawPart1(Pai ntEventArg s * e)
{
graphics* pg = e->graphics;
pg->DrawLine.....(etc.)
}
void graphicForm::drawPart2(Pai ntEventArg s * e)
{
graphics* pg = e->graphics;
pg->DrawLine....(etc.)
}
Any ideas as to what is wrong?
//graphicForm.h===========
void drawPart1(PaintEventArgs * e);
void drawPart2(PaintEventArgs * e);
.....
private: System::Void tabPage1_Paint(System::Obj
{
drawPart1(e); //works fine when this is the only call
drawPart2(e); //crashes when I include this one
}
//graphicForm.cpp=========
void graphicForm::drawPart1(Pai
{
graphics* pg = e->graphics;
pg->DrawLine.....(etc.)
}
void graphicForm::drawPart2(Pai
{
graphics* pg = e->graphics;
pg->DrawLine....(etc.)
}
Any ideas as to what is wrong?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.