?? subject_16223.htm
字號(hào):
<p>
序號(hào):16223 發(fā)表者:mmvr 發(fā)表日期:2002-09-26 15:30:01
<br>主題:緊急求教!CArray CObArray的問(wèn)題
<br>內(nèi)容:我自定義了一個(gè)CObject的子類,CVertex,用來(lái)表示空間的一個(gè)點(diǎn)。然后用一個(gè)CArray或CObArray變量來(lái)存儲(chǔ)一系列的CVertex,編譯聯(lián)接都沒(méi)錯(cuò)誤,但是在用SetAt函數(shù)增加點(diǎn)的時(shí)候總是出錯(cuò)誤,為什么,請(qǐng)指教!
<br><a href="javascript:history.go(-1)">返回上頁(yè)</a><br><a href=http://www.copathway.com/cndevforum/>訪問(wèn)論壇</a></p>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回復(fù)者:徐景周 回復(fù)日期:2002-09-26 15:52:59
<br>內(nèi)容:SetAt中的索引值要求必須存大,不能為空值,否則出錯(cuò),可先增加一空值,再用SetAt修改它的相應(yīng)值。如下所示:<BR><BR>//分段導(dǎo)入數(shù)據(jù)結(jié)構(gòu),jingzhou xu<BR>typedef struct tagSegment <BR>{<BR> double dStartDepth;<BR> double dEndDepth;<BR>}SEGMENT;<BR><BR>CArray<SEGMENT,SEGMENT&> m_SegmentArray;<BR><BR> if(m_SpinSegment.GetPos() > m_SegmentArray.GetSize())<BR> {<BR> m_StartDepth.SetWindowText("");<BR> m_EndDepth.SetWindowText("");<BR> <BR> m_StartDepth.GetWindowText(str);<BR> tmpSegment.dStartDepth = atof(str);<BR> m_EndDepth.GetWindowText(str);<BR> tmpSegment.dEndDepth = atof(str);<BR> m_SegmentArray.Add(tmpSegment);<BR> }<BR> else if(m_SpinSegment.GetPos() <= m_SegmentArray.GetSize())<BR> {<BR> SEGMENT tmpSegment;<BR> CString str;<BR> <BR> m_StartDepth.GetWindowText(str);<BR> tmpSegment.dStartDepth = atof(str);<BR> m_EndDepth.GetWindowText(str);<BR> tmpSegment.dEndDepth = atof(str);<BR> m_SegmentArray.SetAt(m_SpinSegment.GetPos()-1,tmpSegment);<BR> }
<br>
<a href="javascript:history.go(-1)">返回上頁(yè)</a><br><a href=http://www.copathway.com/cndevforum/>訪問(wèn)論壇</a></p></blockquote>
<hr size=1>
<blockquote><p>
回復(fù)者:mmvr 回復(fù)日期:2002-09-26 16:09:24
<br>內(nèi)容:搞定了,多謝!!!
<br>
<a href="javascript:history.go(-1)">返回上頁(yè)</a><br><a href=http://www.copathway.com/cndevforum/>訪問(wèn)論壇</a></p></blockquote>
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -