Hi I'm making a simple drawing program I used offset to set up a specific drawing but when it is drawn it moves by about 1 pixel and if one draws another everything of specific function moves again by 1 pixel so if there many pictures some may be deleted. There'a also another function set without offset and it works fine. What can I do with it? I think one solution could be changing mouse functions but others wont work the problem is in the offset.
Class code:
Code:CS2::CS2(CPoint Start, CPoint End, COLORREF aColor) { m_PunktP = Start; m_PunktD = End; m_Color = aColor; m_Pen = 1; m_EnclRect = CRect(Start, End); m_EnclRect.NormalizeRect(); } CS2::~CS2(void) { } void CS2::Draw(CDC* pDC) { CPen aPen; POINT pt; if(!aPen.CreatePen(PS_SOLID, m_Pen, m_Color)) { AfxMessageBox(_T("Pen creation failed"), MB_OK); AfxAbort(); } CPen* pOldPen = pDC->SelectObject(&aPen); pDC->MoveTo(m_PunktP); pt.x = 0; pt.y = 63; m_PunktP.Offset(pt); pDC->LineTo(m_PunktP); pt.x = 95; pt.y = 0; m_PunktP.Offset(pt); pDC->LineTo(m_PunktP); pt.x = 0; pt.y = -75; m_PunktP.Offset(pt); pDC->LineTo(m_PunktP); pt.x = -32; pt.y = 13; m_PunktP.Offset(pt); pDC->LineTo(m_PunktP); pt.x = 0; pt.y = -13; m_PunktP.Offset(pt); pDC->LineTo(m_PunktP); pt.x = -32; pt.y = 13; m_PunktP.Offset(pt); pDC->LineTo(m_PunktP); pt.x = 0; pt.y = -13; m_PunktP.Offset(pt); pDC->LineTo(m_PunktP); pt.x = -32; pt.y = 13; m_PunktP.Offset(pt); pDC->LineTo(m_PunktP); pDC->SelectObject(pOldPen); }



LinkBack URL
About LinkBacks


