-
May 28th, 2009, 04:18 AM
#1
corodinates used by hdc??
what type of co-ordinates is used by standard hDC object when initialised by GetsafeDC()??
-
May 28th, 2009, 04:26 AM
#2
Re: corodinates used by hdc??
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
Victor Nijegorodov
-
May 28th, 2009, 04:33 AM
#3
Re: corodinates used by hdc??
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);
}
this is method am using can you please tell what type of initialisation is taking place and what coordinates is being used??
-
May 28th, 2009, 04:48 AM
#4
Re: corodinates used by hdc??
Victor Nijegorodov
-
May 28th, 2009, 07:58 AM
#5
Re: corodinates used by hdc??
Originally Posted by pinnachio
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);
}
this is method am using can you please tell what type of initialisation is taking place and what coordinates is being used??
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.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|