i was bored, so i decided to make sin/cos/tan waves. i got htem to work directly on the form (its a MFC app), but when imove a window over it, all of the window's contents get erased
i probably have to add something into the OnPaint() function, but i don't know what. its being drawn directly onto the formCode:void Csin_wave_mfcDlg::OnBnClickedButton2() { CPaintDC dc(this); CRect lRect; GetClientRect(lRect); lRect.NormalizeRect(); // Calculate the distance between each of the lines CPoint pStart; CPoint pEnd; this->GetWindowRect(lRect); // Specify the starting points pStart.y = lRect.Height()/2; pStart.x = 0; double angle=0,rx=0,x=0, y=0; //sin wave dc.MoveTo(pStart); while(angle<=lRect.Width()*2){ x = rx;// + sin(90/180 * 3.14); y = 100 * sin(angle/180 * 3.14)+lRect.Height()/2; pEnd.x = x; pEnd.y = y; dc.LineTo(pEnd); rx+=1; angle+=2; Sleep(1); } //cosine wave dc.MoveTo(pStart); rx=0; angle=0; while(angle<=lRect.Width()*2){ x = rx;// + sin(90/180 * 3.14); y = 100 * cos(angle/180 * 3.14)+lRect.Height()/2; pEnd.x = x; pEnd.y = y; dc.LineTo(pEnd); rx+=1; angle+=2; Sleep(1); } //tan wave dc.MoveTo(pStart); rx=0; angle=0; while(angle<=lRect.Width()*2){ if(angle==90){ angle +=2; } x = rx;// + sin(90/180 * 3.14); y = 100 * tan(angle/180 * 3.14)+lRect.Height()/2; pEnd.x = x; pEnd.y = y; dc.LineTo(pEnd); rx+=1; angle+=2; Sleep(1); } }



LinkBack URL
About LinkBacks



: *shuffles from foot to foot* -er - it was late and I -er- didn't read the post.