anand kumar
December 6th, 2002, 01:27 AM
sir,
i need some help in creating a bitmap over
another bitmap, firstly i have created bitmap
object in doc class, in view class ondraw
function i am displaying this bitmap and in
lbutton mouse click i am placing a bitmap on
the view as well as on the bitmap which i
have declared in doc class, after updateing
all views i am not unable to see the bitmap.
i have given the code below,
help will be appreciated.
void CBitmapnetdgView::OnLButtonDblClk(UINT
nFlags, CPoint point)
{
// TODO: Add your message handler
code here and/or call default
CDC *winDC;
CBitmapnetdgDoc* pDoc = GetDocument();
CDC compatDC;
CBitmap *oldBump;
winDC=GetDC();
compatDC.CreateCompatibleDC(winDC);
compatDC.SetMapMode(MM_TEXT);
compatDC.SetWindowOrg(CPoint(0,0));
oldBump=compatDC.SelectObject(&pDoc->cMouseBm
p);
CPoint pn=compatDC.GetWindowOrg();
Cnode sy;
bool fnd=false;
CClientDC
dc(this);
CDC
memdc1;
//memdc1=GetDC();
CBitmap
m_Bitmap1;
memdc1.CreateCompatibleDC(&dc);
memdc1.SetMapMode(MM_TEXT);;
memdc1.SetWindowOrg(CPoint(0,0));
m_Bitmap1.LoadBitmap(IDB_BITMAP1);
winDC->SelectObject(&m_Bitmap1);
memdc1.SelectObject(&m_Bitmap1);
fnd=true;
CPoint pd;
pd.x=100;
pd.y=100;
dc.BitBlt(pd.x,pd.y,20,20,&memdc1,0,0,SRCCOPY
);
compatDC.BitBlt(pd.x,pd.y,20,20,winDC,0,0,SRC
COPY);
int
mode1=memdc1.GetMapMode();
CPoint
Org1=memdc1.GetViewportOrg();
int
mode2=winDC->GetMapMode();
CPoint
Org2=winDC->GetViewportOrg();
CPen
pen;
pen.CreatePen(PS_SOLID, 1,RGB(255,0,0));
winDC->SelectObject(&pen);
winDC->MoveTo(90,90);
winDC->LineTo(95,95);
ReleaseDC(winDC);
CView::OnLButtonDblClk(nFlags,
point);
}
void CBitmapnetdgView::OnDraw(CDC* pDC)
{
CBitmapnetdgDoc* pDoc =
GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native
data here
// pDC->SetViewportExt(0,0);
CDC compatDC;
CBitmap * oldBmp;
int screenWidth;
int screenHight;
screenWidth=GetSystemMetrics(SM_CXSCREEN);
screenHight=GetSystemMetrics(SM_CYSCREEN);
compatDC.CreateCompatibleDC(pDC);
oldBmp=compatDC.SelectObject(&pDoc->cMouseBmp
);
CDC cTempDC;
cTempDC.Attach(compatDC);
pDC->BitBlt(0,0,screenWidth,screenHight,&cTem
pDC,0,0,SRCCOPY);
cTempDC.Detach();
compatDC.SelectObject(oldBmp);
DeleteDC(compatDC);
TRACE("VIEW\n");
}
bye,bye
anand
i need some help in creating a bitmap over
another bitmap, firstly i have created bitmap
object in doc class, in view class ondraw
function i am displaying this bitmap and in
lbutton mouse click i am placing a bitmap on
the view as well as on the bitmap which i
have declared in doc class, after updateing
all views i am not unable to see the bitmap.
i have given the code below,
help will be appreciated.
void CBitmapnetdgView::OnLButtonDblClk(UINT
nFlags, CPoint point)
{
// TODO: Add your message handler
code here and/or call default
CDC *winDC;
CBitmapnetdgDoc* pDoc = GetDocument();
CDC compatDC;
CBitmap *oldBump;
winDC=GetDC();
compatDC.CreateCompatibleDC(winDC);
compatDC.SetMapMode(MM_TEXT);
compatDC.SetWindowOrg(CPoint(0,0));
oldBump=compatDC.SelectObject(&pDoc->cMouseBm
p);
CPoint pn=compatDC.GetWindowOrg();
Cnode sy;
bool fnd=false;
CClientDC
dc(this);
CDC
memdc1;
//memdc1=GetDC();
CBitmap
m_Bitmap1;
memdc1.CreateCompatibleDC(&dc);
memdc1.SetMapMode(MM_TEXT);;
memdc1.SetWindowOrg(CPoint(0,0));
m_Bitmap1.LoadBitmap(IDB_BITMAP1);
winDC->SelectObject(&m_Bitmap1);
memdc1.SelectObject(&m_Bitmap1);
fnd=true;
CPoint pd;
pd.x=100;
pd.y=100;
dc.BitBlt(pd.x,pd.y,20,20,&memdc1,0,0,SRCCOPY
);
compatDC.BitBlt(pd.x,pd.y,20,20,winDC,0,0,SRC
COPY);
int
mode1=memdc1.GetMapMode();
CPoint
Org1=memdc1.GetViewportOrg();
int
mode2=winDC->GetMapMode();
CPoint
Org2=winDC->GetViewportOrg();
CPen
pen;
pen.CreatePen(PS_SOLID, 1,RGB(255,0,0));
winDC->SelectObject(&pen);
winDC->MoveTo(90,90);
winDC->LineTo(95,95);
ReleaseDC(winDC);
CView::OnLButtonDblClk(nFlags,
point);
}
void CBitmapnetdgView::OnDraw(CDC* pDC)
{
CBitmapnetdgDoc* pDoc =
GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native
data here
// pDC->SetViewportExt(0,0);
CDC compatDC;
CBitmap * oldBmp;
int screenWidth;
int screenHight;
screenWidth=GetSystemMetrics(SM_CXSCREEN);
screenHight=GetSystemMetrics(SM_CYSCREEN);
compatDC.CreateCompatibleDC(pDC);
oldBmp=compatDC.SelectObject(&pDoc->cMouseBmp
);
CDC cTempDC;
cTempDC.Attach(compatDC);
pDC->BitBlt(0,0,screenWidth,screenHight,&cTem
pDC,0,0,SRCCOPY);
cTempDC.Detach();
compatDC.SelectObject(oldBmp);
DeleteDC(compatDC);
TRACE("VIEW\n");
}
bye,bye
anand