Click here to Skip to main content
16,011,805 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Ein Dialog drei Listboxes Pin
MrLonely23-Jan-01 12:07
MrLonely23-Jan-01 12:07 
GeneralRe: Ein Dialog drei Listboxes Pin
Christian Graus23-Jan-01 13:28
protectorChristian Graus23-Jan-01 13:28 
GeneralRe: Ein Dialog drei Listboxes Pin
MrLonely24-Jan-01 6:59
MrLonely24-Jan-01 6:59 
GeneralFocus Changing With Multiple Top Level Pin
23-Jan-01 10:18
suss23-Jan-01 10:18 
QuestionHow modify contextmenu of IE? Pin
Tom K23-Jan-01 6:13
Tom K23-Jan-01 6:13 
GeneralWindows Media Encoder/Format SDKs Pin
Roger23-Jan-01 2:54
Roger23-Jan-01 2:54 
GeneralWindows Media Encoder/Format SDKs Pin
Roger23-Jan-01 2:53
Roger23-Jan-01 2:53 
QuestionHow to draw a bitmap (more than once) without flicker Pin
23-Jan-01 1:50
suss23-Jan-01 1:50 
I have a static control.

In this control I want to draw a bitmap first (a compass) and afterwards I
draw the pointer (the pointer indicates which way the wind goes).

I do this in the OnPaint Function of the Class CWindrose (derived from CStatic).

This function looks like this:

void CWindrose::OnPaint()
{
DrawTransparent(...);
DrawPointer(...);
}

So everything works fine.

My problem is the flicker that appears everytime the OnPaint Function is called.

So:

How to call the bitmap to repaint just the pixels which are changed ???????





P.S.:

This is the Drawing function:

EFErr CWindrose::DrawTransparent(CDC *pDC, int x, int y, COLORREF crColour,CBitmap &Bmp)
{

COLORREF crOldBack = pDC->SetBkColor(RGB(255,255,255));
COLORREF crOldText = pDC->SetTextColor(0);
CDC dcImage, dcTrans;

// Create two memory dcs for the image and the mask
dcImage.CreateCompatibleDC(pDC);
dcTrans.CreateCompatibleDC(pDC);

// Select the image into the appropriate dc
CBitmap* pOldBitmapImage = dcImage.SelectObject(&Bmp);

// Create the mask bitmap
CBitmap bitmapTrans;



BITMAP bm1;
Bmp.GetBitmap(&bm1);
int nHeight= bm1.bmHeight;

BITMAP bm2;
Bmp.GetBitmap(&bm2);
int nWidth = bm2.bmWidth;

bitmapTrans.CreateBitmap(nWidth, nHeight, 1, 1, NULL);

// Select the mask bitmap into the appropriate dc
CBitmap* pOldBitmapTrans = dcTrans.SelectObject(&bitmapTrans);

// Build mask based on transparent colour
dcImage.SetBkColor(crColour);
dcTrans.BitBlt(0, 0, nWidth, nHeight, &dcImage, 0, 0, SRCCOPY);

// Do the work - True Mask method - cool if not actual display
pDC->BitBlt(x, y, nWidth, nHeight, &dcImage, 0, 0, SRCINVERT);
pDC->BitBlt(x, y, nWidth, nHeight, &dcTrans, 0, 0, SRCAND);
pDC->BitBlt(x, y, nWidth, nHeight, &dcImage, 0, 0, SRCINVERT);

// Restore settings
dcImage.SelectObject(pOldBitmapImage);
dcTrans.SelectObject(pOldBitmapTrans);
pDC->SetBkColor(crOldBack);
pDC->SetTextColor(crOldText);

RET_JA
}
AnswerRe: How to draw a bitmap (more than once) without flicker Pin
Chris Losinger23-Jan-01 7:18
professionalChris Losinger23-Jan-01 7:18 
AnswerRe: How to draw a bitmap (more than once) without flicker Pin
Christian Graus23-Jan-01 10:53
protectorChristian Graus23-Jan-01 10:53 
AnswerRe: How to draw a bitmap (more than once) without flicker Pin
23-Jan-01 11:07
suss23-Jan-01 11:07 
QuestionHow to draw a bitmap (more than once) without flicker Pin
23-Jan-01 1:50
suss23-Jan-01 1:50 
GeneralLoading a Font Pin
Bo Helleskov22-Jan-01 23:30
Bo Helleskov22-Jan-01 23:30 
GeneralRe: Loading a Font Pin
Swinefeaster13-Mar-04 13:17
Swinefeaster13-Mar-04 13:17 
GeneralMemory DC incompatible with Desktop Pin
Enrico Pangan22-Jan-01 23:21
Enrico Pangan22-Jan-01 23:21 
GeneralRe: Memory DC incompatible with Desktop Pin
Chris Losinger23-Jan-01 7:41
professionalChris Losinger23-Jan-01 7:41 
GeneralCPU Usage Pin
.::RockNix::.22-Jan-01 20:44
.::RockNix::.22-Jan-01 20:44 
GeneralRe: CPU Usage Pin
22-Jan-01 22:09
suss22-Jan-01 22:09 
QuestionHow to delete some columns in Open File Common Dialog ? Pin
22-Jan-01 20:32
suss22-Jan-01 20:32 
QuestionHow to put process when the dialog box is shown? Pin
22-Jan-01 15:26
suss22-Jan-01 15:26 
AnswerRe: How to put process when the dialog box is shown? Pin
David Fedolfi23-Jan-01 4:32
David Fedolfi23-Jan-01 4:32 
GeneralGeneral advise needed in handling/storing structured data Pin
Member 671822-Jan-01 13:44
Member 671822-Jan-01 13:44 
GeneralNeed some help with file listings Pin
22-Jan-01 10:32
suss22-Jan-01 10:32 
GeneralRe: Need some help with file listings Pin
Joan M22-Jan-01 12:47
professionalJoan M22-Jan-01 12:47 
GeneralRe: Need some help with file listings Pin
Simon Capewell23-Jan-01 1:55
Simon Capewell23-Jan-01 1:55 

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.