here you go sir......
my first step is
checking for if the user has click on a RGB(0,0,128) pixel
the InBus function is as: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); }
andCode:int CPflowDoc::InBus(long x,long y) { int index=GetNumBus(); CBus1* bus; while(index--) { CBus1* bus; bus=GetBus(index); if( x>= bus->m_x1 && x<=abs(bus->m_x2 -bus->m_x1)) { if( y>= bus->m_y1 && y<=abs(bus->m_y2 -bus->m_y1)) { return index; } } } return -1; }
here the problem is it never goes into the if statement......
can u please help me now??




Reply With Quote
