コード例 #1
0
 private void btnProperty_Click(object sender, EventArgs e)
 {
     if (this.m_pPreviewSelSymbol is IMarkerSymbol)
     {
         frmPointSymbolEdit edit = new frmPointSymbolEdit();
         edit.SetSymbol(this.m_pPreviewSelSymbol as ISymbol);
         if (edit.ShowDialog() == DialogResult.OK)
         {
             this.m_pPreviewSelSymbol = edit.GetSymbol();
             this.m_CanDo             = false;
             this.InitControl(this.m_pPreviewSelSymbol);
             this.m_CanDo            = true;
             this.symbolItem1.Symbol = this.m_pPreviewSelSymbol;
             this.symbolItem1.Invalidate();
         }
     }
     else if (this.m_pPreviewSelSymbol is ILineSymbol)
     {
         frmLineSymbolEdit edit2 = new frmLineSymbolEdit
         {
             m_pSG = this.m_pSG
         };
         edit2.SetSymbol(this.m_pPreviewSelSymbol as ISymbol);
         if (edit2.ShowDialog() == DialogResult.OK)
         {
             this.m_pPreviewSelSymbol = edit2.GetSymbol();
             this.m_CanDo             = false;
             this.InitControl(this.m_pPreviewSelSymbol);
             this.m_CanDo            = true;
             this.symbolItem1.Symbol = this.m_pPreviewSelSymbol;
             this.symbolItem1.Invalidate();
         }
     }
     else if (this.m_pPreviewSelSymbol is IFillSymbol)
     {
         frmFillSymbolEdit edit3 = new frmFillSymbolEdit
         {
             m_pSG = this.m_pSG
         };
         edit3.SetSymbol(this.m_pPreviewSelSymbol as ISymbol);
         if (edit3.ShowDialog() == DialogResult.OK)
         {
             this.m_pPreviewSelSymbol = edit3.GetSymbol();
             this.m_CanDo             = false;
             this.InitControl(this.m_pPreviewSelSymbol);
             this.m_CanDo            = true;
             this.symbolItem1.Symbol = this.m_pPreviewSelSymbol;
             this.symbolItem1.Invalidate();
         }
     }
     else if (this.m_pPreviewSelSymbol is ITextSymbol)
     {
         frmTextSymbolEdit edit4 = new frmTextSymbolEdit
         {
             m_pSG = this.m_pSG
         };
         edit4.SetSymbol(this.m_pPreviewSelSymbol as ISymbol);
         if (edit4.ShowDialog() == DialogResult.OK)
         {
             this.m_pPreviewSelSymbol = edit4.GetSymbol();
             this.m_CanDo             = false;
             this.InitControl(this.m_pPreviewSelSymbol);
             this.m_CanDo            = true;
             this.symbolItem1.Symbol = this.m_pPreviewSelSymbol;
             this.symbolItem1.Invalidate();
         }
     }
     else
     {
         frmElementProperty property;
         if (this.m_pPreviewSelSymbol is ISymbolBorder)
         {
             property = new frmElementProperty();
             BorderSymbolPropertyPage page = new BorderSymbolPropertyPage();
             property.Text = "边界";
             property.AddPage(page);
             if (property.EditProperties(this.m_pPreviewSelSymbol))
             {
                 this.symbolItem1.Symbol = this.m_pPreviewSelSymbol;
                 this.symbolItem1.Invalidate();
             }
         }
         else if (this.m_pPreviewSelSymbol is ISymbolBackground)
         {
             property = new frmElementProperty();
             BackgroundSymbolPropertyPage page2 = new BackgroundSymbolPropertyPage();
             property.Text = "背景";
             property.AddPage(page2);
             if (property.EditProperties(this.m_pPreviewSelSymbol))
             {
                 this.symbolItem1.Symbol = this.m_pPreviewSelSymbol;
                 this.symbolItem1.Invalidate();
             }
         }
         else if (this.m_pPreviewSelSymbol is ISymbolShadow)
         {
             property = new frmElementProperty();
             ShadowSymbolPropertyPage page3 = new ShadowSymbolPropertyPage();
             property.Text = "阴影";
             property.AddPage(page3);
             if (property.EditProperties(this.m_pPreviewSelSymbol))
             {
                 this.symbolItem1.Symbol = this.m_pPreviewSelSymbol;
                 this.symbolItem1.Invalidate();
             }
         }
         else if (this.m_pPreviewSelSymbol is INorthArrow)
         {
             property = new frmElementProperty();
             NorthArrowPropertyPage page4 = new NorthArrowPropertyPage();
             property.Text = "指北针";
             property.AddPage(page4);
             if (property.EditProperties(this.m_pPreviewSelSymbol))
             {
                 this.symbolItem1.Symbol = this.m_pPreviewSelSymbol;
                 this.symbolItem1.Invalidate();
             }
         }
         else
         {
             IPropertyPage page5;
             if (this.m_pPreviewSelSymbol is IScaleBar)
             {
                 property = new frmElementProperty
                 {
                     Text = "比例尺"
                 };
                 page5 = new ScaleBarFormatPropertyPage();
                 property.AddPage(page5);
                 page5 = new ScaleAndUnitsPropertyPage();
                 property.AddPage(page5);
                 page5 = new NumberAndLabelPropertyPage();
                 property.AddPage(page5);
                 if (property.EditProperties(this.m_pPreviewSelSymbol))
                 {
                     this.symbolItem1.Symbol = this.m_pPreviewSelSymbol;
                     this.symbolItem1.Invalidate();
                 }
             }
             else if (this.m_pPreviewSelSymbol is IScaleText)
             {
                 property = new frmElementProperty
                 {
                     Text = "比例尺文本"
                 };
                 page5 = new ScaleTextTextPropertyPage();
                 property.AddPage(page5);
                 page5 = new ScaleTextFormatPropertyPage();
                 property.AddPage(page5);
                 if (property.EditProperties(this.m_pPreviewSelSymbol))
                 {
                     this.symbolItem1.Symbol = this.m_pPreviewSelSymbol;
                     this.symbolItem1.Invalidate();
                 }
             }
             else if (this.m_pPreviewSelSymbol is ILegendItem)
             {
                 property = new frmElementProperty
                 {
                     Text = "图例项"
                 };
                 page5 = new LegendItemArrangementPropertyPage();
                 property.AddPage(page5);
                 page5 = new LegendItemGeneralPropertyPage();
                 property.AddPage(page5);
                 if (property.EditProperties(this.m_pPreviewSelSymbol))
                 {
                     this.symbolItem1.Symbol = this.m_pPreviewSelSymbol;
                     this.symbolItem1.Invalidate();
                 }
             }
         }
     }
 }
コード例 #2
0
        private void btnChangeSymbol_Click(object sender, EventArgs e)
        {
            if (!(this.m_pStyleGalleryItem.Item is ISymbol))
            {
                frmElementProperty property;
                object             item = this.m_pStyleGalleryItem.Item;
                if (item is ISymbolBorder)
                {
                    property = new frmElementProperty();
                    BorderSymbolPropertyPage page = new BorderSymbolPropertyPage();
                    property.Text = "边界";
                    property.AddPage(page);
                    if (property.EditProperties(item))
                    {
                        this.symbolItem1.Symbol       = item;
                        this.m_pStyleGalleryItem.Item = item;
                        this.symbolItem1.Invalidate();
                    }
                }
                else if (item is ISymbolBackground)
                {
                    property = new frmElementProperty();
                    BackgroundSymbolPropertyPage page2 = new BackgroundSymbolPropertyPage();
                    property.Text = "背景";
                    property.AddPage(page2);
                    if (property.EditProperties(item))
                    {
                        this.symbolItem1.Symbol       = item;
                        this.m_pStyleGalleryItem.Item = item;
                        this.symbolItem1.Invalidate();
                    }
                }
                else if (item is ISymbolShadow)
                {
                    property = new frmElementProperty();
                    ShadowSymbolPropertyPage page3 = new ShadowSymbolPropertyPage();
                    property.Text = "阴影";
                    property.AddPage(page3);
                    if (property.EditProperties(item))
                    {
                        this.symbolItem1.Symbol       = item;
                        this.m_pStyleGalleryItem.Item = item;
                        this.symbolItem1.Invalidate();
                    }
                }
                else if (item is INorthArrow)
                {
                    property = new frmElementProperty();
                    NorthArrowPropertyPage page4 = new NorthArrowPropertyPage();
                    property.Text = "指北针";
                    property.AddPage(page4);
                    if (property.EditProperties(item))
                    {
                        this.symbolItem1.Symbol       = item;
                        this.m_pStyleGalleryItem.Item = item;
                        this.symbolItem1.Invalidate();
                    }
                }
                else
                {
                    IPropertyPage page5;
                    if (item is IScaleBar)
                    {
                        property = new frmElementProperty
                        {
                            Text = "比例尺"
                        };
                        page5 = new ScaleBarFormatPropertyPage();
                        property.AddPage(page5);
                        page5 = new ScaleAndUnitsPropertyPage();
                        property.AddPage(page5);
                        page5 = new NumberAndLabelPropertyPage();
                        property.AddPage(page5);
                        if (property.EditProperties(item))
                        {
                            this.symbolItem1.Symbol       = item;
                            this.m_pStyleGalleryItem.Item = item;
                            this.symbolItem1.Invalidate();
                        }
                    }
                    else if (item is IScaleText)
                    {
                        property = new frmElementProperty
                        {
                            Text = "比例尺文本"
                        };
                        page5 = new ScaleTextTextPropertyPage();
                        property.AddPage(page5);
                        page5 = new ScaleTextFormatPropertyPage();
                        property.AddPage(page5);
                        if (property.EditProperties(item))
                        {
                            this.symbolItem1.Symbol       = item;
                            this.m_pStyleGalleryItem.Item = item;
                            this.symbolItem1.Invalidate();
                        }
                    }
                    else if (item is ILegendItem)
                    {
                        property = new frmElementProperty
                        {
                            Text = "图例项"
                        };
                        page5 = new LegendItemArrangementPropertyPage();
                        property.AddPage(page5);
                        page5 = new LegendItemGeneralPropertyPage();
                        property.AddPage(page5);
                        if (property.EditProperties(item))
                        {
                            this.symbolItem1.Symbol       = item;
                            this.m_pStyleGalleryItem.Item = item;
                            this.symbolItem1.Invalidate();
                        }
                    }
                }
            }
            else
            {
                DialogResult result;
                ISymbol      pSym = (ISymbol)this.m_pStyleGalleryItem.Item;
                switch (this.m_SymbolType)
                {
                case enumSymbolType.enumSTPoint:
                {
                    frmPointSymbolEdit edit = new frmPointSymbolEdit
                    {
                        m_pSG = this.m_pSG
                    };
                    edit.SetSymbol(pSym);
                    result = edit.ShowDialog();
                    pSym   = edit.GetSymbol();
                    break;
                }

                case enumSymbolType.enumSTLine:
                {
                    frmLineSymbolEdit edit2 = new frmLineSymbolEdit
                    {
                        m_pSG = this.m_pSG
                    };
                    edit2.SetSymbol(pSym);
                    result = edit2.ShowDialog();
                    pSym   = edit2.GetSymbol();
                    break;
                }

                case enumSymbolType.enumSTFill:
                {
                    frmFillSymbolEdit edit3 = new frmFillSymbolEdit
                    {
                        m_pSG = this.m_pSG
                    };
                    edit3.SetSymbol(pSym);
                    result = edit3.ShowDialog();
                    pSym   = edit3.GetSymbol();
                    break;
                }

                case enumSymbolType.enumSTText:
                {
                    frmTextSymbolEdit edit4 = new frmTextSymbolEdit
                    {
                        m_pSG = this.m_pSG
                    };
                    edit4.SetSymbol(pSym);
                    result = edit4.ShowDialog();
                    pSym   = edit4.GetSymbol();
                    break;
                }

                default:
                    return;
                }
                if (result == DialogResult.OK)
                {
                    this.symbolItem1.Symbol       = pSym;
                    this.m_pStyleGalleryItem.Item = pSym;
                    this.symbolItem1.Invalidate();
                }
            }
        }