MFC 类库

1.CWnd

1.1.UpdateData()

作用:

UpdateData() and Updatedata(TRUE) are the same.

UpdateData(TRUE) is used to copy the contents of the controls into the associated variables.

UpdateData(FALSE) is used to put the values in the variables to the associated controls.

1.2CString

1.2.1Format 与printf()类似

void Format( LPCTSTR lpszFormat, ... );  void Format( UINT nFormatID, ... );

例:

CString str = "Some Data";
str.Format("%s%d", str, 123);  //%s 字符串,%d有符号十进制,%u无符号十进制,%o八进制

1.3 MFC集合类 : http://msdn.microsoft.com/en-us/library/fw2702d6(v=vs.60).aspx

   CArray:  template< class TYPE, class ARG_TYPE > class CArray : public CObject

注意:其可以自动分配和删除内存

   (1)Add(i):返回添加后元素的index

// example for CArray::Add   ---引用自msdn
CArray<CPoint,CPoint> ptArray;

CPoint pt(10,20);
ptArray.Add(pt);             // Element 0
ptArray.Add(CPoint(30,40));  // Element 1   

   (2)Get(i)给出给定索引值的数据

   (3)GetSize()获得元素的数量
   (4)IsEmpty()判断是否为空
   (5)Insert()在指定位置插入

 

 

 

 



 

 

  

 

posted @ 2014-11-15 14:06  Xiaodigua  阅读(256)  评论(0编辑  收藏  举报