关于VC++ ARRAY集合类的使用

关于VC++ ARRAY集合类的使用
我使用CArray*m_PointList;定义了m_PointList存放一条曲线上所有的点。
现在点已经储存完毕,我希望将这些点再用m_PointList画出来,应该使用什么函数?越详细越好
//做个循环,从m_PointList里读出所有点就好了啊
我主要是对集合类里的函数不了解。能具体说下吗?比如GetAt()什么的~~~~~还有那个GETHEADPOSITION,,,
做个循环,从m_PointList里读出所有兄销点就好了啊



CPoint p;

for(i=0;iGetSize();i++)

p=m_PointList->GetAt(i)



你没装MSDN??,没这个搞VC开发是不可升仔能的,太多的函数和类了,你根本记不过来吵尘汪

给你贴点这个类的函数
CArray Class Members
Construction

CArray Constructs an empty array.

Attributes

GetSize Gets the number of elements in this array.
GetUpperBound Returns the largest valid index.
SetSize Sets the number of elements to be contained in this array.

Operations

FreeExtra Frees all unused memory above the current upper bound.
RemoveAll Removes all the elements from this array.

Element Access

GetAt Returns the value at a given index.
SetAt Sets the value for a given index; array not allowed to grow.
ElementAt Returns a temporary reference to the element pointer within the array.
GetData Allows access to elements in the array. Can be NULL.

Growing the Array

SetAtGrow Sets the value for a given index; grows the array if necessary.
Add Adds an element to the end of the array; grows the array if necessary.
Append Appends another array to the array; grows the array if necessary
Copy Copies another array to the array; grows the array if necessary.

Insertion/Removal

InsertAt Inserts an element (or all the elements in another array) at a specified index.
RemoveAt Removes an element at a specific index.

Operators

operator [] Sets or gets the element at the specified index.

CArray Overview | Base Class Members | Hierarchy Chart

--------------------------------------------------------------------------------
Send feedback to MSDN.Look here for MSDN Online resources.
集合类对象在序列化存取的时候,会把指针指向的对象同时键好冲稿歼存取,具体你可以看下序列化函数的代码
这里提供下CObArray的序列化袜乱代码供参考
void CObArray::Serialize(CArchive& ar)
{
ASSERT_VALID(this);

CObject::Serialize(ar);

if (ar.IsStoring())
{
ar.WriteCount(m_nSize);
for (int i = 0; i < m_nSize; i++)
ar << m_pData[i];
}
else
{
DWORD nOldSize = ar.ReadCount();
SetSize(nOldSize);
for (int i = 0; i < m_nSize; i++)
ar >> m_pData[i];
}
}
答案:不知道
什么意思?你想在哪画,就在相应的函数中实现就得了呗?
← 上一篇: 下一篇: →