what type of co-ordinates is used by standard hDC object when initialised by GetsafeDC()??
Printable View
what type of co-ordinates is used by standard hDC object when initialised by GetsafeDC()??
I guess it depends upon how you initialized this HDC object and what you did with it before this call.
Read about GDI coordinate space here: http://msdn.microsoft.com/en-us/libr...66(VS.85).aspx
this is method am using can you please tell what type of initialisation is taking place and what coordinates is being used??Code:void CPflowView::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
long tempx=point.x ;
long tempy=point.y ;
CPflowDoc* pDoc = GetDocument();
pDC=GetDC();
OnPrepareDC(pDC);
pDC->DPtoLP(&point);
x2=point.x;
y2=point.y ;
HDC hDC= pDC->GetSafeHdc();
if(bCheckBusOpt==FALSE)
{
if(GetPixel(hDC,point.x,point.y)==RGB(0,0,128))
{
busindex=pDoc->InBus (x2 ,y2 );
/*char temp[10];
ltoa(busindex,temp,10);
MessageBox(temp);*/
if(busindex>=0)
{SetCapture();m_dragging=TRUE;}
}
}
if(bCheckBusOpt==TRUE)
DrawBus();
CScrollView::OnLButtonDown(nFlags, point);
}
Perhaps, GetDeviceCaps and Coordinate Space and Transformation Functions could help you?
By the looks of it, this would be determined in the OnPrepareDC() call. A default CScrollView::OnPrepareDC() adjusts the viewport offset relative to the scroll position of the scroll view's scroll bars so coordinates are relative to a virtual "document", a section of which is visible through the client window of the view. You maybe should use CClientDC() instead of GetDC() in line 7 of your code.