this code draws grey lines,horizontal and vertical in center of screen
Code:OnDraw() { CRect rect; GetClientRect(rect); CPen penGrey; // Construct it, then initialize if( penGrey.CreatePen( PS_SOLID, 0, RGB(200,200,200) ) ) { // Select it into the device context // Save the old pen at the same time CPen* pOldPen = pDC->SelectObject( &penGrey ); // Draw with the pen //draws axis pDC->MoveTo(rect.right/2,rect.top); pDC->LineTo(rect.right/2,rect.bottom); pDC->MoveTo(rect.right,rect.bottom/2); pDC->LineTo(rect.left,rect.bottom/2); // Restore the old pen to the device context pDC->SelectObject( pOldPen ); } else { MessageBox("Resources are running low\nPlease close one or more applications"); } }




Reply With Quote