示例#1
0
 private void btnReName_Click(object sender, EventArgs e)
 {
     if (this.listBoxControl1.SelectedIndex != -1)
     {
         SymbolIdentifierWrap selectedItem = this.listBoxControl1.SelectedItem as SymbolIdentifierWrap;
         frmInput             input        = new frmInput("名称:", selectedItem.AnnotateLayerProperties.Class)
         {
             Text = "输入新类名"
         };
         if (input.ShowDialog() == DialogResult.OK)
         {
             if (input.InputValue.Trim().Length == 0)
             {
                 MessageBox.Show("非法类名!");
             }
             else
             {
                 for (int i = 0; i < this.listBoxControl1.Items.Count; i++)
                 {
                     SymbolIdentifierWrap wrap2 = this.listBoxControl1.Items[i] as SymbolIdentifierWrap;
                     if (wrap2.AnnotateLayerProperties.Class == input.InputValue)
                     {
                         MessageBox.Show("类名必须唯一!");
                         return;
                     }
                 }
                 selectedItem.AnnotateLayerProperties.Class = input.InputValue;
                 this.method_5(selectedItem);
             }
         }
     }
 }
示例#2
0
        private void btnNew_Click(object sender, EventArgs e)
        {
            frmInput input = new frmInput("名称:", "")
            {
                Text = "输入"
            };

            if (input.ShowDialog() == DialogResult.OK)
            {
                if (input.InputValue.Trim().Length == 0)
                {
                    MessageBox.Show("非法类名!");
                }
                else
                {
                    ISymbolIdentifier2 identifier;
                    for (int i = 0; i < this.listBoxControl1.Items.Count; i++)
                    {
                        SymbolIdentifierWrap wrap = this.listBoxControl1.Items[i] as SymbolIdentifierWrap;
                        if (wrap.AnnotateLayerProperties.Class == input.InputValue)
                        {
                            MessageBox.Show("类名必须唯一!");
                            return;
                        }
                    }
                    ITextSymbol symbol   = new TextSymbolClass();
                    int         symbolID = this.method_4(NewObjectClassHelper.m_pObjectClassHelper.m_pSymbolColl);
                    NewObjectClassHelper.m_pObjectClassHelper.m_pSymbolColl.set_Symbol(symbolID, symbol as ISymbol);
                    IAnnotateLayerProperties item = new LabelEngineLayerPropertiesClass
                    {
                        Class         = input.InputValue,
                        FeatureLinked = NewObjectClassHelper.m_pObjectClassHelper.IsRelatedFeature,
                        AddUnplacedToGraphicsContainer = false,
                        CreateUnplacedElements         = true,
                        DisplayAnnotation = true,
                        UseOutput         = true
                    };
                    ILabelEngineLayerProperties properties2 = item as ILabelEngineLayerProperties;
                    if (NewObjectClassHelper.m_pObjectClassHelper.IsRelatedFeature)
                    {
                        new AnnotationVBScriptEngineClass();
                        IFeatureClass relatedFeatureClass =
                            NewObjectClassHelper.m_pObjectClassHelper.RelatedFeatureClass;
                        properties2.Expression         = "[" + relatedFeatureClass.ObjectClassID + "]";
                        properties2.IsExpressionSimple = true;
                    }
                    properties2.Offset   = 0.0;
                    properties2.SymbolID = symbolID;
                    properties2.Symbol   = symbol;
                    NewObjectClassHelper.m_pObjectClassHelper.m_pAnnoPropertiesColn.Add(item);
                    NewObjectClassHelper.m_pObjectClassHelper.m_pSymbolColl.GetSymbolIdentifier(symbolID, out identifier);
                    this.listBoxControl1.Items.Add(new SymbolIdentifierWrap(item, identifier));
                }
            }
        }