Click here to Skip to main content
15,915,093 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: AfxBeginThread problem (with member function) Pin
BlackDice1-Jun-04 5:54
BlackDice1-Jun-04 5:54 
GeneralRe: AfxBeginThread problem (with member function) Pin
jmkhael1-Jun-04 5:59
jmkhael1-Jun-04 5:59 
GeneralRe: AfxBeginThread problem (with member function) Pin
BlackDice1-Jun-04 6:06
BlackDice1-Jun-04 6:06 
Generalvector problem Pin
BlackDice1-Jun-04 5:19
BlackDice1-Jun-04 5:19 
GeneralRe: vector problem Pin
Diddy1-Jun-04 5:34
Diddy1-Jun-04 5:34 
GeneralRe: vector problem Pin
BlackDice1-Jun-04 5:42
BlackDice1-Jun-04 5:42 
GeneralM.S.Chart Problem Pin
Member 3287141-Jun-04 4:59
Member 3287141-Jun-04 4:59 
GeneralMemory device context help Pin
JHAKAS1-Jun-04 4:55
JHAKAS1-Jun-04 4:55 
Theme of code:

Draw to Memdc

in OnDraw
Stretch over the clientDc

Save the dc content to the image file

Problem faced

Well this code is executed in starting time i.e. 1-2 turn when the function is called it will display the things drawn on the view. Even when we save bitmap it does save to BMP file (3.6Mb)

After 1-2 turns it makes screen blasnk and the MemDC contains nothing. Even when MemDC is saved as Bitmap file then it makes BMP file of 1*1 pixel and of size 70 bytes.

What can be the problem? My MemDC is member variable of the class.

<br />
<br />
void CMyView:rawWFRDiagram(int Velocity)<br />
{<br />
  char cc[10];<br />
  int maxdelay = -1;<br />
  CPatternDoc *pDoc = GetDocument();<br />
<br />
  CSize sizeTotal;	<br />
  sizeTotal.cx = 590;   sizeTotal.cy = 1100;<br />
  SetScrollSizes(MM_LOENGLISH, sizeTotal);<br />
  <br />
  CClientDC ClientDC(this);<br />
  OnPrepareDC(&ClientDC);<br />
  <br />
  ClientDC.SetMapMode(MM_TEXT);<br />
   m_WfrBmp -- Member of CMyView of type CBitmap<br />
   m_WfrBmp.DeleteObject ();    <br />
   m_WfrBmp.CreateCompatibleBitmap(&ClientDC, 860, 1100);<br />
   MemDC.CreateCompatibleDC(&ClientDC);	<br />
   CBitmap *pOldBitmap = MemDC.SelectObject(&m_WfrBmp);<br />
   MemDC.SetMapMode(MM_TEXT);			<br />
   MemDC.PatBlt(0, 0, 860, 1100, WHITENESS);		<br />
<br />
     Draw anything further to the MemDC<br />
<br />
   <br />
  MemDC.SetMapMode(MM_LOENGLISH);<br />
  // STRETCH THE DRAWING ON THE CANVAS I.E. VIEW<br />
  if(ClientDC.StretchBlt(50, 0, 860, -1100, &MemDC, 0, 0, 860,<br />
     -1100, SRCCOPY) == FALSE)<br />
     AfxMessageBox("Failed to draw WFR diagram"); <br />
}<br />
<br />
OnDraw()<br />
{<br />
pDC->StretchBlt(50, 0, 860, -1100, &MemDC, 0, 0, 860, -1100, SRCCOPY);<br />
<br />
}<br />



Help me to solve this problem?

Thanks in advance


Sandeep




Leave your mark wherever you go
GeneralRe: Memory device context help Pin
JHAKAS1-Jun-04 5:11
JHAKAS1-Jun-04 5:11 
GeneralRe: Memory device context help Pin
PJ Arends1-Jun-04 22:05
professionalPJ Arends1-Jun-04 22:05 
GeneralIllegal conversion warning Pin
Jim Crafton1-Jun-04 4:15
Jim Crafton1-Jun-04 4:15 
GeneralRe: Illegal conversion warning Pin
Antony M Kancidrowski1-Jun-04 4:39
Antony M Kancidrowski1-Jun-04 4:39 
GeneralRe: Illegal conversion warning Pin
Antony M Kancidrowski1-Jun-04 4:48
Antony M Kancidrowski1-Jun-04 4:48 
GeneralRe: Illegal conversion warning Pin
Michael Dunn1-Jun-04 5:04
sitebuilderMichael Dunn1-Jun-04 5:04 
GeneralRe: Illegal conversion warning Pin
Marcello1-Jun-04 6:16
Marcello1-Jun-04 6:16 
GeneralRe: Illegal conversion warning Pin
Marcello1-Jun-04 6:41
Marcello1-Jun-04 6:41 
GeneralRe: Illegal conversion warning Pin
Anonymous17-Jun-04 9:53
Anonymous17-Jun-04 9:53 
GeneralUsing TRACE macro Pin
Anonymous1-Jun-04 3:24
Anonymous1-Jun-04 3:24 
GeneralRe: Using TRACE macro Pin
David Crow1-Jun-04 3:41
David Crow1-Jun-04 3:41 
GeneralRe: Using TRACE macro Pin
jmkhael1-Jun-04 3:45
jmkhael1-Jun-04 3:45 
GeneralRe: Using TRACE macro Pin
Anonymous1-Jun-04 8:43
Anonymous1-Jun-04 8:43 
GeneralRe: Using TRACE macro Pin
Anonymous1-Jun-04 9:01
Anonymous1-Jun-04 9:01 
GeneralMy Dialog-Window (not minimized), is hidden under other windows, how to make active/top/etc Pin
ohadp1-Jun-04 3:24
ohadp1-Jun-04 3:24 
GeneralRe: My Dialog-Window (not minimized), is hidden under other windows, how to make active/top/etc Pin
Antony M Kancidrowski1-Jun-04 4:11
Antony M Kancidrowski1-Jun-04 4:11 
GeneralRe: My Dialog-Window (not minimized), is hidden under other windows, how to make active/top/etc Pin
ohadp1-Jun-04 4:27
ohadp1-Jun-04 4:27 

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.