Home > Software engineering >  MFC contact load different images appear breakpoints, breakpoint continue normal operation
MFC contact load different images appear breakpoints, breakpoint continue normal operation

Time:11-20

The source code below
The CDC * dc1=m_img1. GetDC (), * dc2=m_img2 GetDC (), * dc3=m_img3 GetDC (), * dc4=m_img4. GetDC ();//h for handle
The CDC * dc5=m_img5. GetDC (), * dc6=m_img6 GetDC (), * dc7=m_img7 GetDC (), * dc8=m_img8. GetDC ();
The CDC * dc9=m_img9. GetDC (), * dc10=m_img10 GetDC (), * dc11=m_img11 GetDC (), * dc12=m_img12. GetDC ();
Int height and width;
if(! Img. The IsNull ()) img. Destroy ();
Cstrings imgPath=_T (" E: \ \ MFC midterm \ \ "), STR, imgPath1;
for(int i=1; I<9. I++)
{

STR. The Format (_T (" % d "), I);
ImgPath1=imgPath + STR + _T (" PNG ");
MessageBox (imgPath1);
Img. Load (imgPath1);
Height=img. GetHeight ()/10;
Width=img. GetWidth ()/10;
TransparentPNG (& amp; Img);
If (! Img. The IsNull ())
The switch (I) {
Case 1: img. The Draw (dc1 - & gt; M_hDC, CRect (0, 0, width, height)); break;
Case 2: img. The Draw (dc2 - & gt; M_hDC, CRect (0, 0, width, height)); break;
Case 3: img. The Draw (dc3 - & gt; M_hDC, CRect (0, 0, width, height)); break;
Case 4: img. The Draw (dc4 - & gt; M_hDC, CRect (0, 0, width, height)); break;
Case 5: img. The Draw (dc5 - & gt; M_hDC, CRect (0, 0, width, height)); break;
Case 6: img. The Draw (dc6 - & gt; M_hDC, CRect (0, 0, width, height)); break;
Case 7: img. The Draw (dc7 - & gt; M_hDC, CRect (0, 0, width, height)); break;
Case 8: img. The Draw (dc8 - & gt; M_hDC, CRect (0, 0, width, height)); break;
Case 9: img. The Draw (dc9 - & gt; M_hDC, CRect (0, 0, width, height)); break;
Case 10: img. The Draw (dc10 - & gt; M_hDC, CRect (0, 0, width, height)); break;
Case 11: img. The Draw (dc11 - & gt; M_hDC, CRect (0, 0, width, height)); break;
Case 12: img. The Draw (dc12 - & gt; M_hDC, CRect (0, 0, width, height)); break;
}
}
Want to achieve 1. PNG; 2. PNG, named after the digital serial number different controls the import of the picture;
But after running a breakpoint
ATLASSUME (m_hBitmap==NULL);
The breakpoint to skip continue to achieve expected effect, ask is what reason
Save the children, the child was really hard

CodePudding user response:

If (! Img. The IsNull ()) on the img. Determine whether effective immediately after the Load

CodePudding user response:

Or not,,, is still a breakpoint

CodePudding user response:

If (! Img. The IsNull ()) img. Destroy ();
If (img. Load (XXXX)==S_OK)
{
.
}

CodePudding user response:

Find ATLASSUME (m_hBitmap==NULL); Where is the

CodePudding user response:

Has been solved, modify debug for release
  • Related