MFC笔记10

1.

CDC MemDC1;

MemDC1.SetBkMode(OPAQUE);

背景模式,VC6下面有三种:
/* Background Modes */
#define TRANSPARENT 1//透明
#define OPAQUE 2//不透明
#define BKMODE_LAST 2//上一模式,其实就是不透明

2.MFC加特定字体

你可以用系统帮助的例子试一下,如果可以就是你字体的问题.
我估计你没有加"方正姚体"这个字库.不过CE好像没有这个字库吧.

// Initializes a CFont object with the specified characteristics.
CFont font;
VERIFY(font.CreateFont(
   12,                        // nHeight
   0,                         // nWidth
   0,                         // nEscapement
   0,                         // nOrientation
   FW_NORMAL,                 // nWeight
   FALSE,                     // bItalic
   FALSE,                     // bUnderline
   0,                         // cStrikeOut
   ANSI_CHARSET,              // nCharSet
   OUT_DEFAULT_PRECIS,        // nOutPrecision
   CLIP_DEFAULT_PRECIS,       // nClipPrecision
   DEFAULT_QUALITY,           // nQuality
   DEFAULT_PITCH | FF_SWISS,  // nPitchAndFamily
   _T("Arial")));                 // lpszFacename

// Use the font which you just created.
CClientDC dc(this);  
CFont* def_font = dc.SelectObject(&font);
dc.ExtTextOut(5, 5, ETO_OPAQUE, NULL, _T("Hello"), NULL);
dc.SelectObject(def_font);

// Finished with the font, now delete the font object.
font.DeleteObject(); 

 3.c++ MFC int 转换成 CString

 int s = 123; 
CString str;
str.Format(_T("%d"), s);

4.清空CString 型变量

但是具体运用的时候只能这样表达:
CByteArray a;
a.RemoveAll(); 
CString b;
b.Empty();

CString c[]={1,2,3,4,5};
for(int i=0;i<sizeof(c);i++)
{
    c[i].Empty();
}

  

 

原文地址:https://www.cnblogs.com/zhangerxiaoma/p/5065748.html