private void btnRename_Click(object sender, EventArgs e) { frmInput input = new frmInput("名称:", this.iannotateLayerProperties_0.Class) { Text = "输入新类名" }; if (input.ShowDialog() == DialogResult.OK) { if (input.InputValue.Trim().Length == 0) { MessageBox.Show("非法类名!"); } else { AnnotateLayerPropertiesWrap selectedItem; for (int i = 0; i < this.cboClass.Properties.Items.Count; i++) { selectedItem = this.cboClass.Properties.Items[i] as AnnotateLayerPropertiesWrap; if (selectedItem.AnnotateLayerProperties.Class == input.InputValue) { MessageBox.Show("类名必须唯一!"); return; } } selectedItem = this.cboClass.SelectedItem as AnnotateLayerPropertiesWrap; this.iannotateLayerProperties_0.Class = input.InputValue; this.bool_3 = true; selectedItem.Update = true; } } }
private void btnAddClass_Click(object sender, EventArgs e) { frmInput input = new frmInput("类名称:", ""); if (input.ShowDialog() == DialogResult.OK) { if (input.InputValue.Trim().Length == 0) { MessageBox.Show("非法类名!"); } else { for (int i = 0; i < this.cboClass.Properties.Items.Count; i++) { AnnotateLayerPropertiesWrap wrap = this.cboClass.Properties.Items[i] as AnnotateLayerPropertiesWrap; if (wrap.AnnotateLayerProperties.Class == input.InputValue) { MessageBox.Show("类名必须唯一!"); return; } } IAnnotateLayerProperties properties = new LabelEngineLayerPropertiesClass { Class = input.InputValue, FeatureLinked = this.iannotateLayerProperties_0.FeatureLinked, FeatureLayer = this.iannotateLayerProperties_0.FeatureLayer, AddUnplacedToGraphicsContainer = this.iannotateLayerProperties_0.AddUnplacedToGraphicsContainer, AnnotationMaximumScale = this.iannotateLayerProperties_0.AnnotationMaximumScale, AnnotationMinimumScale = this.iannotateLayerProperties_0.AnnotationMinimumScale, CreateUnplacedElements = this.iannotateLayerProperties_0.CreateUnplacedElements, DisplayAnnotation = this.iannotateLayerProperties_0.DisplayAnnotation, LabelWhichFeatures = this.iannotateLayerProperties_0.LabelWhichFeatures, Priority = this.iannotateLayerProperties_0.Priority, UseOutput = this.iannotateLayerProperties_0.UseOutput, WhereClause = this.iannotateLayerProperties_0.WhereClause }; ILabelEngineLayerProperties properties2 = properties as ILabelEngineLayerProperties; ILabelEngineLayerProperties properties3 = this.iannotateLayerProperties_0 as ILabelEngineLayerProperties; properties2.Expression = properties3.Expression; properties2.IsExpressionSimple = properties3.IsExpressionSimple; int num2 = this.method_2(); properties2.SymbolID = num2; properties2.Symbol = (properties3.Symbol as IClone).Clone() as ITextSymbol; this.cboClass.Properties.Items.Add(new AnnotateLayerPropertiesWrap(properties, num2, true)); this.bool_3 = true; } } }