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

C / C++ / MFC

 
AnswerRe: Showing memory contents into a HTMLView? Pin
David Salter4-Dec-02 12:12
David Salter4-Dec-02 12:12 
GeneralControl not showing immediately Pin
Brigg Thorp4-Dec-02 1:19
Brigg Thorp4-Dec-02 1:19 
QuestionBitBlt not working? Pin
S O S4-Dec-02 0:38
S O S4-Dec-02 0:38 
AnswerRe: BitBlt not working? Pin
Christian Graus4-Dec-02 0:43
protectorChristian Graus4-Dec-02 0:43 
GeneralRe: BitBlt not working? Pin
S O S4-Dec-02 5:22
S O S4-Dec-02 5:22 
GeneralRe: BitBlt not working? Pin
KaЯl4-Dec-02 5:30
KaЯl4-Dec-02 5:30 
GeneralRe: BitBlt not working? Pin
S O S4-Dec-02 5:50
S O S4-Dec-02 5:50 
GeneralRe: BitBlt not working? Pin
KaЯl4-Dec-02 6:03
KaЯl4-Dec-02 6:03 
Ok, it's here probably the problem, there's no data in you document's object. Memory DCs require a bitmap which is the one with stores the graphical info.

When you create your document DC, create also a compatible bitmap (look at CBitmap::CreateCompatibleBitmap), select it in your memory DC, draw on it then BitBlt on your "device" DC.

Here a sample of the mechanic to use, extracted from a drawing method, with
m_SelectionRect = rectangle used to draw "on memory"
DrawMyObject(CDC *pDC): method which actually draws through pDC
dc: the "device" DC

CDC TempMemDC;<br />
CBitmap *pTempBitmap = new CBitmap();<br />
VERIFY(TempMemDC.CreateCompatibleDC(NULL));<br />
VERIFY(pTempBitmap->CreateCompatibleBitmap(&dc, m_SelectionRect.Width(),<br />
m_SelectionRect.Height())); <br />
CBitmap *pOldBitmap = (CBitmap *) TempMemDC.SelectObject(pTempBitmap); <br />
TempMemDC.BitBlt(0, 0, m_SelectionRect.Width(), m_SelectionRect.Height(), BLACKNESS);<br />
// Draw the module in the MemDC<br />
DrawMyObject(&TempMemDC);<br />
dc.BitBlt(0, 0, m_SelectionRect.Width(), m_SelectionRect.Height(), &TempMemDC, 0, 0, SRCCOPY);<br />
// reselect old bitmap<br />
TempMemDC.SelectObject(pOldBitmap);




HTH,






Ohé Partisans, Ouvriers et Paysans
C'est l'alarme!

Le Chant des Partisans

GeneralRe: BitBlt not working? Pin
S O S4-Dec-02 7:46
S O S4-Dec-02 7:46 
GeneralRe: BitBlt not working? Pin
KaЯl4-Dec-02 13:35
KaЯl4-Dec-02 13:35 
GeneralRepaint slider channel Pin
Neha3-Dec-02 23:46
Neha3-Dec-02 23:46 
GeneralRe: Repaint slider channel Pin
KaЯl3-Dec-02 23:58
KaЯl3-Dec-02 23:58 
GeneralRe: MyListCtrl.SetSelectionMark doesn't call OnItemChangedLCtrl(...) Pin
MFC is the Best4-Dec-02 0:15
MFC is the Best4-Dec-02 0:15 
Generaltext from edit to list box Pin
xxhimanshu3-Dec-02 23:21
xxhimanshu3-Dec-02 23:21 
GeneralRe: text from edit to list box Pin
Michael P Butler3-Dec-02 23:48
Michael P Butler3-Dec-02 23:48 
GeneralRe: text from edit to list box Pin
Joan M3-Dec-02 23:54
professionalJoan M3-Dec-02 23:54 
GeneralRe: text from edit to list box Pin
xxhimanshu4-Dec-02 0:06
xxhimanshu4-Dec-02 0:06 
GeneralProblems with data conversion Pin
Gian3-Dec-02 22:57
Gian3-Dec-02 22:57 
GeneralRe: Problems with data conversion Pin
Hans Ruck4-Dec-02 0:50
Hans Ruck4-Dec-02 0:50 
GeneralRe: Problems with data conversion Pin
Gian4-Dec-02 3:02
Gian4-Dec-02 3:02 
GeneralODBC, SQL and MFC Pin
MFC is the Best3-Dec-02 22:48
MFC is the Best3-Dec-02 22:48 
GeneralRe: ODBC, SQL and MFC Pin
Alexandru Savescu3-Dec-02 23:03
Alexandru Savescu3-Dec-02 23:03 
GeneralRe: ODBC, SQL and MFC Pin
MFC is the Best3-Dec-02 23:59
MFC is the Best3-Dec-02 23:59 
GeneralRe: ODBC, SQL and MFC Pin
Alexandru Savescu4-Dec-02 1:12
Alexandru Savescu4-Dec-02 1:12 
GeneralRe: ODBC, SQL and MFC Pin
MFC is the Best4-Dec-02 1:20
MFC is the Best4-Dec-02 1:20 

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.