Click here to Skip to main content
15,914,209 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: motion capturing and rendering Pin
ThatsAlok6-Oct-05 18:15
ThatsAlok6-Oct-05 18:15 
AnswerRe: motion capturing and rendering Pin
Trollslayer6-Oct-05 12:40
mentorTrollslayer6-Oct-05 12:40 
Questiongetting columns fields name Pin
pnpfriend6-Oct-05 8:43
pnpfriend6-Oct-05 8:43 
AnswerRe: getting columns fields name Pin
Wes Aday6-Oct-05 9:55
professionalWes Aday6-Oct-05 9:55 
GeneralRe: getting columns fields name Pin
pnpfriend6-Oct-05 12:58
pnpfriend6-Oct-05 12:58 
QuestionBring CBitmap to top windows Pin
fjlv20056-Oct-05 6:01
fjlv20056-Oct-05 6:01 
AnswerRe: Bring CBitmap to top windows Pin
Rage6-Oct-05 6:29
professionalRage6-Oct-05 6:29 
GeneralRe: Bring CBitmap to top windows Pin
fjlv20056-Oct-05 6:38
fjlv20056-Oct-05 6:38 
actually i create a class CMyBitmap derived from CBitmap,
void DrawTransparent (CDC* pDC, int x, int y, COLORREF clrTransparency);
void Draw (CDC* pDC, int x, int y);

The actual call is
CMyBitmap bmpheader;
bmpheader.LoadBitmap(IDB_LISTHHISTORY);
bmpheader.DrawTransparent(GetDC(),24,85,RGB(255,0,255));

My bitmap is long and it hit some area where listbox is, but what happens is that the hit area appears that my bitmap is behind the listbox, i wanted the opposite. I wanted my bitmap to be on top of whatever control it encounter on its area..

Thanks...

Below is the Code:
void CDTGBitmap::Draw(CDC *pDC, int x, int y)
{
BITMAP bm;
GetBitmap (&bm);
CPoint size (bm.bmWidth, bm.bmHeight);
pDC->DPtoLP (&size);
CPoint org (0, 0);
pDC->DPtoLP (&org);
CDC dcMem;
dcMem.CreateCompatibleDC (pDC);
CBitmap* pOldBitmap = dcMem.SelectObject (this);
pDC->BitBlt (x, y, size.x, size.y, &dcMem, org.x, org.y, SRCCOPY);
dcMem.SelectObject (pOldBitmap);
}

void CDTGBitmap::DrawTransparent(CDC *pDC, int x, int y, COLORREF clrTransparency)
{
BITMAP bm;
GetBitmap (&bm);
CPoint size (bm.bmWidth, bm.bmHeight);
pDC->DPtoLP (&size);

CPoint org (0, 0);
pDC->DPtoLP (&org);

CDC dcImage;
dcImage.CreateCompatibleDC (pDC);
CBitmap* pOldBitmapImage = dcImage.SelectObject (this);
CDC dcAnd;
dcAnd.CreateCompatibleDC (pDC);
CBitmap bitmapAnd;
bitmapAnd.CreateBitmap (bm.bmWidth, bm.bmHeight, 1, 1, NULL);
CBitmap* pOldBitmapAnd = dcAnd.SelectObject (&bitmapAnd);

dcImage.SetBkColor (clrTransparency);
dcAnd.BitBlt (org.x, org.y, size.x, size.y, &dcImage, org.x, org.y, SRCCOPY);


CDC dcXor;
dcXor.CreateCompatibleDC (pDC);
CBitmap bitmapXor;
bitmapXor.CreateCompatibleBitmap (&dcImage, bm.bmWidth, bm.bmHeight);
CBitmap* pOldBitmapXor = dcXor.SelectObject (&bitmapXor);

dcXor.BitBlt (org.x, org.y, size.x, size.y, &dcImage, org.x, org.y,
SRCCOPY);

dcXor.BitBlt (org.x, org.y, size.x, size.y, &dcAnd, org.x, org.y,
0x220326);
CDC dcTemp;
dcTemp.CreateCompatibleDC (pDC);
CBitmap bitmapTemp;
bitmapTemp.CreateCompatibleBitmap (&dcImage, bm.bmWidth, bm.bmHeight);
CBitmap* pOldBitmapTemp = dcTemp.SelectObject (&bitmapTemp);

dcTemp.BitBlt (org.x, org.y, size.x, size.y, pDC, x, y, SRCCOPY);
dcTemp.BitBlt (org.x, org.y, size.x, size.y, &dcAnd, org.x, org.y,SRCAND);

dcTemp.BitBlt (org.x, org.y, size.x, size.y, &dcXor, org.x, org.y,SRCINVERT);
pDC->BitBlt (x, y, size.x, size.y, &dcTemp, org.x, org.y, SRCCOPY);
dcTemp.SelectObject (pOldBitmapTemp);
dcXor.SelectObject (pOldBitmapXor);
dcAnd.SelectObject (pOldBitmapAnd);
dcImage.SelectObject (pOldBitmapImage);
}
GeneralRe: Bring CBitmap to top windows Pin
Jose Lamas Rios6-Oct-05 19:16
Jose Lamas Rios6-Oct-05 19:16 
QuestionMFC Radio Buttons - can't add them as member variables Pin
Axonn Echysttas6-Oct-05 5:58
Axonn Echysttas6-Oct-05 5:58 
AnswerRe: MFC Radio Buttons - can't add them as member variables Pin
Neelesh K J Jain6-Oct-05 6:10
Neelesh K J Jain6-Oct-05 6:10 
GeneralRe: MFC Radio Buttons - can't add them as member variables Pin
Axonn Echysttas6-Oct-05 7:45
Axonn Echysttas6-Oct-05 7:45 
AnswerRe: MFC Radio Buttons - can't add them as member variables Pin
Rage6-Oct-05 6:26
professionalRage6-Oct-05 6:26 
AnswerRe: MFC Radio Buttons - can't add them as member variables Pin
David Crow6-Oct-05 7:15
David Crow6-Oct-05 7:15 
Questionhelp on redraw CView ? Pin
tracywang6-Oct-05 5:53
tracywang6-Oct-05 5:53 
AnswerRe: help on redraw CView ? Pin
Neelesh K J Jain6-Oct-05 6:24
Neelesh K J Jain6-Oct-05 6:24 
GeneralRe: help on redraw CView ? Pin
ashwin206-Oct-05 20:15
ashwin206-Oct-05 20:15 
AnswerRe: help on redraw CView ? Pin
Prakash Nadar6-Oct-05 15:54
Prakash Nadar6-Oct-05 15:54 
AnswerRe: help on redraw CView ? Pin
ashwin206-Oct-05 20:06
ashwin206-Oct-05 20:06 
QuestionProblems with memory when quitting application. ( and other boundschecker stuff/ranting ) Pin
Maximilien6-Oct-05 5:31
Maximilien6-Oct-05 5:31 
AnswerRe: Problems with memory when quitting application. ( and other boundschecker stuff/ranting ) Pin
Prakash Nadar6-Oct-05 15:51
Prakash Nadar6-Oct-05 15:51 
QuestionConvert String to LPSTR ? Pin
Phernando6-Oct-05 5:29
Phernando6-Oct-05 5:29 
GeneralRe: Convert String to LPSTR ? Pin
toxcct6-Oct-05 5:41
toxcct6-Oct-05 5:41 
AnswerRe: Convert String to LPSTR ? Pin
PJ Arends6-Oct-05 7:30
professionalPJ Arends6-Oct-05 7:30 
QuestionDebuggin In Visual C++ .NET Pin
BlitzPackage6-Oct-05 5:06
BlitzPackage6-Oct-05 5:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.