private void GeometricEffectLinePage_Load(object sender, EventArgs e)
        {
            if (base.m_pGeometricEffect == null)
            {
                base.m_pGeometricEffect = new BasicLineSymbolClass();
            }
            int graphicAttributeCount =
                ((base.m_pGeometricEffect as IBasicLineSymbol).Stroke as IGraphicAttributes).GraphicAttributeCount;
            IGraphicAttributes stroke = (base.m_pGeometricEffect as IBasicLineSymbol).Stroke as IGraphicAttributes;
            int    attrId             = stroke.get_ID(0);
            string str = stroke.get_Name(attrId);

            this.textBox1.Text = stroke.get_Value(attrId).ToString();
            this.textBox1.Tag  = attrId;
            attrId             = stroke.get_ID(1);
            str = stroke.get_Name(attrId);
            this.comboBox1.SelectedIndex = (int)stroke.get_Value(attrId);
            this.comboBox1.Tag           = attrId;
            attrId = stroke.get_ID(2);
            str    = stroke.get_Name(attrId);
            this.comboBox2.SelectedIndex = (int)stroke.get_Value(attrId);
            this.comboBox2.Tag           = attrId;
            attrId = stroke.get_ID(3);
            str    = stroke.get_Name(attrId);
            object obj2 = stroke.get_Value(attrId);

            this.symbolItem1.Symbol = obj2;
            this.symbolItem1.Tag    = attrId;
            this.m_CanDo            = true;
        }
        public override bool Apply()
        {
            double val = 0.0;

            try
            {
                val = double.Parse(this.textBox1.Text);
            }
            catch
            {
                MessageBox.Show("请出入数字型数据!");
                return(false);
            }
            if ((this.comboBox1.SelectedIndex == -1) || (this.comboBox2.SelectedIndex == -1))
            {
                return(false);
            }
            IGraphicAttributes stroke = (base.m_pGeometricEffect as IBasicLineSymbol).Stroke as IGraphicAttributes;

            stroke.set_Value((int)this.textBox1.Tag, val);
            stroke.set_Value((int)this.comboBox1.Tag, this.comboBox1.SelectedIndex);
            stroke.set_Value((int)this.comboBox2.Tag, this.comboBox2.SelectedIndex);
            stroke.set_Value((int)this.symbolItem1.Tag, this.symbolItem1.Symbol);
            return(true);
        }
Exemple #3
0
 private void solidColorToolStripMenuItem_Click(object sender, EventArgs e)
 {
     this.m_CanDo = false;
     if (!this.solidColorToolStripMenuItem.Checked)
     {
         this.solidColorToolStripMenuItem.Checked = true;
         this.hatchToolStripMenuItem.Checked      = false;
         this.gradientToolStripMenuItem.Checked   = false;
         IFillPattern       pattern    = new SolidColorPatternClass();
         IGraphicAttributes attributes = pattern as IGraphicAttributes;
         int    attrId = attributes.get_ID(0);
         string str    = attributes.get_Name(attrId);
         this.symbolItem1.Tag    = attrId;
         this.symbolItem1.Symbol = attributes.get_Value(attrId);
         this.panel1.Visible     = true;
         this.panel4.Visible     = false;
         this.panel3.Visible     = false;
         int height = this.panel2.Bottom + this.panel1.Height;
         base.Size = new Size(base.Width, height);
         try
         {
             (base.m_pGeometricEffect as IBasicFillSymbol).FillPattern = pattern;
         }
         catch
         {
         }
     }
     this.m_CanDo = true;
 }
Exemple #4
0
 private void gradientToolStripMenuItem_Click(object sender, EventArgs e)
 {
     this.m_CanDo = false;
     if (!this.gradientToolStripMenuItem.Checked)
     {
         this.gradientToolStripMenuItem.Checked   = true;
         this.solidColorToolStripMenuItem.Checked = false;
         this.hatchToolStripMenuItem.Checked      = false;
         IFillPattern       pattern    = new GradientPatternClass();
         IGraphicAttributes attributes = pattern as IGraphicAttributes;
         this.panel1.Visible = false;
         this.panel4.Visible = false;
         this.panel3.Visible = true;
         int height = this.panel2.Bottom + this.panel3.Height;
         base.Size = new Size(base.Width, height);
         int    attrId = attributes.get_ID(0);
         string str    = attributes.get_Name(attrId);
         this.symbolItemColor1.Symbol = attributes.get_Value(attrId);
         this.symbolItemColor1.Tag    = attrId;
         attrId = attributes.get_ID(1);
         str    = attributes.get_Name(attrId);
         this.symbolItemColor2.Symbol = attributes.get_Value(attrId);
         this.symbolItemColor2.Tag    = attrId;
         attrId                       = attributes.get_ID(2);
         str                          = attributes.get_Name(attrId);
         this.comboBox1.Tag           = attrId;
         this.comboBox1.SelectedIndex = (int)attributes.get_Value(attrId);
         attrId                       = attributes.get_ID(3);
         str                          = attributes.get_Name(attrId);
         this.comboBox2.Tag           = attrId;
         this.comboBox2.SelectedIndex = (int)attributes.get_Value(attrId);
         attrId                       = attributes.get_ID(4);
         str                          = attributes.get_Name(attrId);
         this.txtInterval.Tag         = attrId;
         this.txtInterval.Text        = attributes.get_Value(attrId).ToString();
         attrId                       = attributes.get_ID(5);
         str                          = attributes.get_Name(attrId);
         this.txtPercent.Tag          = attrId;
         this.txtPercent.Text         = attributes.get_Value(attrId).ToString();
         attrId                       = attributes.get_ID(5);
         str                          = attributes.get_Name(attrId);
         this.txtAngleGrad.Tag        = attrId;
         this.txtAngleGrad.Text       = attributes.get_Value(attrId).ToString();
         try
         {
             (base.m_pGeometricEffect as IBasicFillSymbol).FillPattern = pattern;
         }
         catch
         {
         }
     }
     this.m_CanDo = true;
 }
Exemple #5
0
        private static IStyleGalleryItem3 ConvertMarkerItemToRep(IStyleGalleryItem3 inputItem)
        {
            IMarkerSymbol           markerSymbol = inputItem.Item as IMarkerSymbol;
            IRepresentationRule     repRule      = new RepresentationRuleClass();
            IRepresentationRuleInit repRuleInit  = repRule as IRepresentationRuleInit;

            repRuleInit.InitWithSymbol((ISymbol)markerSymbol); //initialize the rep rule with the marker
            IRepresentationGraphics representationGraphics = new RepresentationMarkerClass();

            IGraphicAttributes      graphicAttributes  = null;
            IRepresentationGraphics tempMarkerGraphics = null;
            IGeometry           tempGraphicGeometry    = null;
            IRepresentationRule tempRule = null;

            //only pull the markers out.
            for (int i = 0; i < repRule.LayerCount; i++)
            {
                graphicAttributes  = repRule.get_Layer(i) as IGraphicAttributes;
                tempMarkerGraphics = graphicAttributes.get_Value((int)esriGraphicAttribute.esriGAMarker) as IRepresentationGraphics;

                tempMarkerGraphics.Reset();
                tempMarkerGraphics.Next(out tempGraphicGeometry, out tempRule);

                while (tempRule != null && tempGraphicGeometry != null)
                {
                    representationGraphics.Add(tempGraphicGeometry, tempRule);
                    tempGraphicGeometry = null;
                    tempRule            = null;
                    tempMarkerGraphics.Next(out tempGraphicGeometry, out tempRule);
                }
            }

            IStyleGalleryItem3 newMarkerStyleGalleryItem = new ServerStyleGalleryItemClass();

            newMarkerStyleGalleryItem.Item     = representationGraphics;
            newMarkerStyleGalleryItem.Name     = inputItem.Name;
            newMarkerStyleGalleryItem.Category = inputItem.Category;
            newMarkerStyleGalleryItem.Tags     = inputItem.Tags.Replace(";emf", ""); //strip emf from the tags

            return(newMarkerStyleGalleryItem);
        }
Exemple #6
0
        public override bool Apply()
        {
            IGraphicAttributes fillPattern =
                (base.m_pGeometricEffect as IBasicFillSymbol).FillPattern as IGraphicAttributes;

            if (fillPattern.ClassName == "1")
            {
                fillPattern.set_Value((int)this.symbolItem1.Tag, this.symbolItem1.Symbol);
            }
            else
            {
                double num;
                double num2;
                if (fillPattern.ClassName == "2")
                {
                    num  = 0.0;
                    num2 = 0.0;
                    double val  = 0.0;
                    double num4 = 0.0;
                    try
                    {
                        num = double.Parse(this.txtWidth.Text);
                    }
                    catch
                    {
                        MessageBox.Show("请出入数字型数据!");
                        return(false);
                    }
                    try
                    {
                        num2 = double.Parse(this.txtAngle.Text);
                    }
                    catch
                    {
                        MessageBox.Show("请出入数字型数据!");
                        return(false);
                    }
                    try
                    {
                        val = double.Parse(this.txtStep.Text);
                    }
                    catch
                    {
                        MessageBox.Show("请出入数字型数据!");
                        return(false);
                    }
                    try
                    {
                        num4 = double.Parse(this.txtOffset.Text);
                    }
                    catch
                    {
                        MessageBox.Show("请出入数字型数据!");
                        return(false);
                    }
                    fillPattern.set_Value((int)this.HatchsymbolItem.Tag, this.HatchsymbolItem.Symbol);
                    fillPattern.set_Value((int)this.txtWidth.Tag, num);
                    fillPattern.set_Value((int)this.txtAngle.Tag, num2);
                    fillPattern.set_Value((int)this.txtStep.Tag, val);
                    fillPattern.set_Value((int)this.txtOffset.Tag, num4);
                }
                else if (fillPattern.ClassName == "3")
                {
                    num = 0.0;
                    double num5 = 0.0;
                    num2 = 0.0;
                    try
                    {
                        num = double.Parse(this.txtInterval.Text);
                    }
                    catch
                    {
                        MessageBox.Show("请出入数字型数据!");
                        return(false);
                    }
                    try
                    {
                        num5 = double.Parse(this.txtInterval.Text);
                    }
                    catch
                    {
                        MessageBox.Show("请出入数字型数据!");
                        return(false);
                    }
                    try
                    {
                        num2 = double.Parse(this.txtAngle.Text);
                    }
                    catch
                    {
                        MessageBox.Show("请出入数字型数据!");
                        return(false);
                    }
                    if ((this.comboBox1.SelectedIndex == -1) || (this.comboBox2.SelectedIndex == -1))
                    {
                        return(false);
                    }
                    fillPattern.set_Value((int)this.symbolItemColor1.Tag, this.symbolItemColor1.Symbol);
                    fillPattern.set_Value((int)this.symbolItemColor2.Tag, this.symbolItemColor2.Symbol);
                    fillPattern.set_Value((int)this.comboBox1.Tag, this.comboBox1.SelectedIndex);
                    fillPattern.set_Value((int)this.comboBox2.Tag, this.comboBox2.SelectedIndex);
                    fillPattern.set_Value((int)this.txtInterval.Tag, num);
                    fillPattern.set_Value((int)this.txtAngleGrad.Tag, num2);
                    fillPattern.set_Value((int)this.txtPercent.Tag, num5);
                }
            }
            return(true);
        }
Exemple #7
0
        private void GeometricEffectFillPage_Load(object sender, EventArgs e)
        {
            int    num2;
            string str;
            int    num3;

            if (base.m_pGeometricEffect == null)
            {
                base.m_pGeometricEffect = new BasicFillSymbolClass();
            }
            IGraphicAttributes fillPattern =
                (base.m_pGeometricEffect as IBasicFillSymbol).FillPattern as IGraphicAttributes;

            switch (fillPattern.GraphicAttributeCount)
            {
            case 1:
                num2 = fillPattern.get_ID(0);
                str  = fillPattern.get_Name(num2);
                this.symbolItem1.Symbol = fillPattern.get_Value(num2);
                this.symbolItem1.Tag    = num2;
                this.panel1.Visible     = true;
                this.panel4.Visible     = false;
                this.panel3.Visible     = false;
                num3      = this.panel2.Bottom + this.panel1.Height;
                base.Size = new Size(base.Width, num3);
                this.solidColorToolStripMenuItem.Checked = true;
                break;

            case 5:
                this.panel1.Visible = false;
                this.panel4.Visible = true;
                this.panel3.Visible = false;
                num3      = this.panel2.Bottom + this.panel4.Height;
                base.Size = new Size(base.Width, num3);
                num2      = fillPattern.get_ID(0);
                str       = fillPattern.get_Name(num2);
                this.HatchsymbolItem.Symbol = fillPattern.get_Value(num2);
                this.HatchsymbolItem.Tag    = num2;
                num2 = fillPattern.get_ID(1);
                str  = fillPattern.get_Name(num2);
                this.txtWidth.Text = fillPattern.get_Value(num2).ToString();
                this.txtWidth.Tag  = num2;
                num2 = fillPattern.get_ID(2);
                str  = fillPattern.get_Name(num2);
                this.txtAngle.Text = fillPattern.get_Value(num2).ToString();
                this.txtAngle.Tag  = num2;
                num2 = fillPattern.get_ID(3);
                str  = fillPattern.get_Name(num2);
                this.txtStep.Text = fillPattern.get_Value(num2).ToString();
                this.txtStep.Tag  = num2;
                num2 = fillPattern.get_ID(4);
                str  = fillPattern.get_Name(num2);
                this.txtOffset.Text = fillPattern.get_Value(num2).ToString();
                this.txtOffset.Tag  = num2;
                this.hatchToolStripMenuItem.Checked = true;
                break;

            case 7:
                this.panel1.Visible = false;
                this.panel4.Visible = false;
                this.panel3.Visible = true;
                num3      = this.panel2.Bottom + this.panel3.Height;
                base.Size = new Size(base.Width, num3);
                num2      = fillPattern.get_ID(0);
                str       = fillPattern.get_Name(num2);
                this.symbolItemColor1.Symbol = fillPattern.get_Value(num2);
                this.symbolItemColor1.Tag    = num2;
                num2 = fillPattern.get_ID(1);
                str  = fillPattern.get_Name(num2);
                this.symbolItemColor2.Symbol = fillPattern.get_Value(num2);
                this.symbolItemColor2.Tag    = num2;
                num2 = fillPattern.get_ID(2);
                str  = fillPattern.get_Name(num2);
                this.comboBox1.SelectedIndex = (int)fillPattern.get_Value(num2);
                this.comboBox1.Tag           = num2;
                num2 = fillPattern.get_ID(3);
                str  = fillPattern.get_Name(num2);
                this.comboBox2.SelectedIndex = (int)fillPattern.get_Value(num2);
                this.comboBox2.Tag           = num2;
                num2 = fillPattern.get_ID(4);
                str  = fillPattern.get_Name(num2);
                this.txtInterval.Text = fillPattern.get_Value(num2).ToString();
                this.txtInterval.Tag  = num2;
                num2 = fillPattern.get_ID(5);
                str  = fillPattern.get_Name(num2);
                this.txtPercent.Text = fillPattern.get_Value(num2).ToString();
                this.txtPercent.Tag  = num2;
                num2 = fillPattern.get_ID(6);
                str  = fillPattern.get_Name(num2);
                this.txtAngleGrad.Text = fillPattern.get_Value(num2).ToString();
                this.txtAngleGrad.Tag  = num2;
                this.gradientToolStripMenuItem.Checked = true;
                break;
            }
            this.m_CanDo = true;
        }