Link to home
Start Free TrialLog in
Avatar of restabro
restabroFlag for United States of America

asked on

Forcing a Paint Event with a menu selection

I'm trying to to use a Main Menu selection to draw some graphics on a tab page within the same form. I'm not sure how to do this...is there a way to force a Paint Event when the menu item is selcted? This is the code I have so far.

OutputBox..h=================

void draw100MCF(System::Windows::Forms::PaintEventArgs *  e)

private: System::Void mcfLimitMenu_Click(System::Object *  sender, System::EventArgs *  e)
{
      draw100MCF(e);  //this is the function that draws on the TabPage. This doesn't work
                                          //since this "e" isn't the "PaintEventArgs e" that the function is expecting
}

private: System::Void tabPage1_Paint(System::Object *  sender, System::Windows::Forms::PaintEventArgs *  e)
 {
       if (this->mcfLimitMenu->Checked == true)
            draw100MCF(e);
 }

draw100MCF========================

void OutputBox::draw100MCF(System::Windows::Forms::PaintEventArgs *  e)
{
      Graphics* pg = e->Graphics;
      Pen* pen1 = new Pen(Color::Black, 3.0);

                DrawLine(pen1,....etc.);
}

Is there a way to have the "mcfLimitMenu_Click" do nothing more than force a "tabPage1 Paint Event" to be fired?
ASKER CERTIFIED SOLUTION
Avatar of AlexFM
AlexFM

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial