阅读:2264回复:1
AE开发如何实现属性表字段的修改?
我想开发一个属性输入界面,选中图形特征后,出来一个框,可以直接输入特征的属性数据,这个开发思路是怎样的?
|
|
|
1楼#
发布于:2007-07-30 11:17
<P>先设置图形为编辑状态,然后修改属性,最后结束编辑状态。</P>
<P>BOOL SetFieldsValue(IFeaturePtr ;ipFeature, CString strField, CString strValue)<BR>{<BR> if (ipFeature == NULL)<BR> return FALSE;<BR> <BR> // 得到属性字段集<BR> IFieldsPtr ipFields;<BR> HRESULT result = ipFeature->get_Fields(;ipFields);<BR> if (FAILED(result))<BR> return FALSE;</P> <P> long lIndex = -1;<BR> result = ipFields->FindField(CComBSTR(strField), ;lIndex);<BR> if (FAILED(result) || -1 == lIndex) {<BR> result = ipFields->FindFieldByAliasName(CComBSTR(strField), ;lIndex);<BR> if (FAILED(result) || -1 == lIndex)<BR> return FALSE;<BR> }<BR> <BR> _variant_t va(strValue);<BR> result = ipFeature->put_Value(lIndex, va);<BR> ipFeature->Store();<BR> return SUCCEEDED(result);<BR>}</P> |
|
|