C# code
//2011年2月23日
//来源:互联网
//***********************************************
pFeatureLayer = pLayer as IFeatureLayer;
pFeatureClass = pFeatureLayer.FeatureClass;
IField pField = new FieldClass();
IFieldEdit pFieldEdit = pField as IFieldEdit;
pFieldEdit.Name_2 = textBoxFieldName.Text.ToString();
pFieldEdit.Type_2 = esriFieldType.esriFieldTypeDouble;
pFieldEdit.AliasName_2 = textBoxFieldAlias.Text.ToString();
pFeatureClass.AddField(pFieldEdit);
//***********************************************

IFieldEdit是在创建字段的时候使用的,可以设置字段的类型、名称、别名等,IField是只读的,不能设置字段本身的属性(如名称、类型、别名),另外在.NET语言中使用时,需要在IFieldEdit的属性后加上“_2”。修改已有字段的属性,使用IClassSchemaEdit。

相关文章:

  • 2022-01-20
  • 2022-12-23
  • 2022-12-23
  • 2021-11-23
  • 2022-02-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-20
  • 2022-12-23
  • 2021-11-11
  • 2022-12-23
  • 2021-07-31
  • 2022-12-23
  • 2021-07-02
相关资源
相似解决方案