Does anyone use MFC?
I have a problem executing graphics functions.

void CMainFrame::OnTimer(UINT idEvent)
{
idEvent++;         //when a time event occurs do some         
pointG2.y-=3;            //graphics
pointG=pointG2;
TimerEvent();
InvalidateRect(NULL, TRUE); //to call OnDraw
}
 
void Csail_boatView::OnDraw(CDC* pDC)
{
   //graphics functions here
   //they compile OK
   //OnDraw is called by the even timer above
   //the graphic funtions fail to work
 
}

Any thoughts?
Ross

Recommended Answers

All 2 Replies

>>Any thoughts?

Nope, since you didn't post any relevant code.

>>Any thoughts?

Nope, since you didn't post any relevant code.

void CMainFrame::OnTimer(UINT idEvent)
{
idEvent++;
pointG2.y-=3;
pointG=pointG2;
TimerEvent();
InvalidateRect(NULL, TRUE);
}
 
void Csail_boatView::OnDraw(CDC* pDC)
{
 
  pDC->MoveTo(pointG); //example fn of many
  CPoint pt2;               //they execute fine when OnDraw
  pt2.x=xb-x;              //is called at window creation
  pt2.y=yb+3*x;
  pDC->LineTo(pt2);   //they don't work when OnDraw is
                             //called by the OnTimer event above 
 
}

Ross

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.