Exemple #1
0
 public FrmFrameShadow(string[] symbolstyle, ISymbolShadow symbolshadow)
 {
     InitializeComponent();
     this.EnableGlass = false;
     SymbolStyle      = symbolstyle;
     SymbolShadow     = symbolshadow;
 }
Exemple #2
0
        //阴影样式选择
        private void btShadowStyle_Click(object sender, EventArgs e)
        {
            if (pStyleGalleryItem != null)
            {
                ISymbolShadow pSShadow = pStyleGalleryItem.Item as ISymbolShadow;
                IFillSymbol   pFS      = pSShadow.FillSymbol;
                FrmSymbol     Frm      = new FrmSymbol(SymbolStyle, (ISymbol)pFS, esriSymbologyStyleClass.esriStyleClassFillSymbols);
                Frm.ShowDialog();
                if (Frm.DialogResult == DialogResult.OK)
                {
                    pFillSymbol = Frm.GetStyleGalleryItem().Item as IFillSymbol;
                    this.SizeShadowOutline.Text = pFillSymbol.Outline.Width.ToString();

                    IColor pFillColor = pFillSymbol.Color;
                    Color  pColorFill = ColorTranslator.FromOle(pFillColor.RGB);
                    colorFill.SelectedColor = pColorFill;

                    IColor pOutlineColor = pFillSymbol.Outline.Color;
                    Color  pColorOutline = ColorTranslator.FromOle(pOutlineColor.RGB);
                    colorOutline.SelectedColor = pColorOutline;

                    SymbolShadow            = pStyleGalleryItem.Item as ISymbolShadow;
                    SymbolShadow.FillSymbol = pFillSymbol;
                    PreviewImage();
                }
            }
            else
            {
                MessageBox.Show("请选择一种样式!");
            }
        }
Exemple #3
0
 private void btReturnShadow_Click(object sender, EventArgs e)
 {
     //IFrameProperties pFrameProperties = pMapSurroundFrame as IFrameProperties;
     //pFrameProperties.Shadow = null;
     pSymbolShadow  = null;
     btShadow.Image = null;
 }
        private void FrmFrameAttribute_Load(object sender, EventArgs e)
        {
            IFrameElement    FrameElement    = Element as IFrameElement;
            IFrameProperties FrameProperties = FrameElement as IFrameProperties;

            //设置默认边框、背景、阴影

            if (FrameProperties.Border != null)
            {
                FrmFrameBorder Frm = new FrmFrameBorder(SymbolStyle, (ISymbolBorder)FrameProperties.Border);

                if (btBorder.Image != null)
                {
                    btBorder.Image.Dispose();
                }
                btBorder.Image = Frm.GetImageByGiveSymbolBeforeSelectItem(esriSymbologyStyleClass.esriStyleClassBorders, (ISymbolBorder)FrameProperties.Border, btBorder.Width - 14, btBorder.Height - 14);

                //记录
                pSymbolBorder = FrameProperties.Border as ISymbolBorder;
                //重新加载
                SymbolBorder             = FrameProperties.Border as ISymbolBorder;
                this.txtBorderAngle.Text = SymbolBorder.CornerRounding.ToString();
                this.txtBorderGap.Text   = SymbolBorder.Gap.ToString();
            }
            if (FrameProperties.Background != null)
            {
                FrmFrameBackground Frm = new FrmFrameBackground(SymbolStyle, (ISymbolBackground)FrameProperties.Background);
                if (btBackground.Image != null)
                {
                    btBackground.Image.Dispose();
                }
                btBackground.Image = Frm.GetImageByGiveSymbolBeforeSelectItem(esriSymbologyStyleClass.esriStyleClassBackgrounds, (ISymbolBackground)FrameProperties.Background, btBackground.Width - 14, btBackground.Height - 14);

                //记录
                pSymbolBackground = FrameProperties.Background as ISymbolBackground;
                //重新加载
                SymbolBackground             = FrameProperties.Background as ISymbolBackground;
                this.txtBackgroundAngle.Text = SymbolBackground.CornerRounding.ToString();
                this.txtBackgroundGap.Text   = SymbolBackground.Gap.ToString();
            }
            if (FrameProperties.Shadow != null)
            {
                FrmFrameShadow Frm = new FrmFrameShadow(SymbolStyle, (ISymbolShadow)FrameProperties.Shadow);
                if (btShadow.Image != null)
                {
                    btShadow.Image.Dispose();
                }
                btShadow.Image = Frm.GetImageByGiveSymbolBeforeSelectItem(esriSymbologyStyleClass.esriStyleClassShadows, (ISymbolShadow)FrameProperties.Shadow, btShadow.Width - 14, btShadow.Height - 14);

                //记录
                pSymbolShadow = FrameProperties.Shadow as ISymbolShadow;
                //重新加载
                SymbolShadow             = FrameProperties.Shadow as ISymbolShadow;
                this.txtShadowAngle.Text = SymbolShadow.CornerRounding.ToString();
                this.txtShadowX.Text     = SymbolShadow.HorizontalSpacing.ToString();
                this.txtShadowY.Text     = SymbolShadow.VerticalSpacing.ToString();
            }
        }
        //更新界面值,false-界面值更新至对象,true-对象值更新至界面
        private void UpdateUI(bool bValue)
        {
            if (bValue)
            {
                #region 更新界面
                //批北针属性
                this.NorthArrowAngle.Value = m_pNorthArrow.CalibrationAngle;
                this.NorthArrowSize.Value  = m_pNorthArrow.Size;
                IColor pNorthArrowColor = m_pNorthArrow.Color;
                Color  pColor           = ColorTranslator.FromOle(pNorthArrowColor.RGB);
                colorNorthArrow.SelectedColor = pColor;

                //Frame属性
                IFrameProperties pFrameProperties = m_pMapFrame as IFrameProperties;
                if (pFrameProperties.Border != null)
                {
                    FrmFrameBorder Frm = new FrmFrameBorder(m_strSymbolStyle, (ISymbolBorder)pFrameProperties.Border);
                    btBorder.Image = Frm.GetImageByGiveSymbolBeforeSelectItem(esriSymbologyStyleClass.esriStyleClassBorders, (ISymbolBorder)pFrameProperties.Border, btBorder.Width - 14, btBorder.Height - 14);
                    //pOriNAborder = pFrameProperties.Border as ISymbolBorder;
                    //重新加载
                    ISymbolBorder SymbolBorder = pFrameProperties.Border as ISymbolBorder;
                    this.txtBorderAngle.Text = SymbolBorder.CornerRounding.ToString();
                    this.txtBorderGap.Text   = SymbolBorder.Gap.ToString();
                }

                if (pFrameProperties.Background != null)
                {
                    FrmFrameBackground Frm = new FrmFrameBackground(m_strSymbolStyle, (ISymbolBackground)pFrameProperties.Background);
                    btBackground.Image = Frm.GetImageByGiveSymbolBeforeSelectItem(esriSymbologyStyleClass.esriStyleClassBackgrounds, (ISymbolBackground)pFrameProperties.Background, btBackground.Width - 14, btBackground.Height - 14);
                    //pOriNAbackground = pFrameProperties.Background as ISymbolBackground;
                    //重新加载
                    ISymbolBackground SymbolBackground = pFrameProperties.Background as ISymbolBackground;
                    this.txtBackgroundAngle.Text = SymbolBackground.CornerRounding.ToString();
                    this.txtBackgroundGap.Text   = SymbolBackground.Gap.ToString();
                }
                if (pFrameProperties.Shadow != null)
                {
                    FrmFrameShadow Frm = new FrmFrameShadow(m_strSymbolStyle, (ISymbolShadow)pFrameProperties.Shadow);
                    btShadow.Image = Frm.GetImageByGiveSymbolBeforeSelectItem(esriSymbologyStyleClass.esriStyleClassShadows, (ISymbolShadow)pFrameProperties.Shadow, btShadow.Width - 14, btShadow.Height - 14);
                    //pOriNAshadow = pFrameProperties.Shadow as ISymbolShadow;

                    //重新加载
                    ISymbolShadow SymbolShadow = pFrameProperties.Shadow as ISymbolShadow;
                    this.txtShadowAngle.Text = SymbolShadow.CornerRounding.ToString();
                    this.txtShadowX.Text     = SymbolShadow.HorizontalSpacing.ToString();
                    this.txtShadowY.Text     = SymbolShadow.VerticalSpacing.ToString();
                }
                m_hookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
                #endregion
            }
            else
            {
                #region 更新对象属性值

                #endregion
            }
        }
Exemple #6
0
        //阴影填充颜色设计
        private void colorFill_SelectedColorChanged(object sender, EventArgs e)
        {
            if (pStyleGalleryItem != null)
            {
                SymbolShadow = pStyleGalleryItem.Item as ISymbolShadow;
                IFillSymbol pFS = SymbolShadow.FillSymbol;
                pFS.Color = ClsGDBDataCommon.ColorToIColor(colorFill.SelectedColor);

                SymbolShadow.FillSymbol = pFS;
                PreviewImage();
            }
        }
 public void SetObjects(object @object)
 {
     this.m_pOldSymbolBackground = @object as ISymbolShadow;
     if (this.m_pOldSymbolBackground != null)
     {
         this.m_pSymbolBackground = (this.m_pOldSymbolBackground as IClone).Clone() as ISymbolShadow;
     }
     else
     {
         this.m_pSymbolBackground = null;
     }
 }
Exemple #8
0
        private void btShadow_Click(object sender, EventArgs e)
        {
            FrmFrameShadow Frm = new FrmFrameShadow(SymbolStyle, SymbolShadow);

            Frm.ShowDialog();
            if (Frm.DialogResult == DialogResult.OK)
            {
                SymbolShadow = Frm.GetSymbolShadow();
                if (SymbolShadow != null)
                {
                    btShadow.Image = Frm.GetImageByGiveSymbolAfterSelectItem(btShadow.Width - 14, btShadow.Height - 14);
                }
            }
        }
Exemple #9
0
        //阴影边线大小设计
        private void SizeShadowOutline_ValueChanged(object sender, EventArgs e)
        {
            if (pStyleGalleryItem != null)
            {
                SymbolShadow = pStyleGalleryItem.Item as ISymbolShadow;
                IFillSymbol pFS = SymbolShadow.FillSymbol;
                ILineSymbol pLS = pFS.Outline;

                pLS.Width = double.Parse(this.SizeShadowOutline.Text);

                pFS.Outline             = pLS;
                SymbolShadow.FillSymbol = pFS;

                PreviewImage();
            }
        }
        //阴影
        private void btShadow_Click(object sender, EventArgs e)
        {
            IFrameProperties pFrameProperties = m_pMapFrame as IFrameProperties;
            FrmFrameShadow   Frm = new FrmFrameShadow(m_strSymbolStyle, (ISymbolShadow)pFrameProperties.Shadow);

            Frm.ShowDialog();
            if (Frm.DialogResult == DialogResult.OK)
            {
                ISymbolShadow SymbolShadow = Frm.GetSymbolShadow();
                if (SymbolShadow != null)
                {
                    btShadow.Image          = Frm.GetImageByGiveSymbolAfterSelectItem(btShadow.Width - 14, btShadow.Height - 14);
                    pFrameProperties.Shadow = SymbolShadow;
                    m_hookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
                }
            }
        }
Exemple #11
0
        private void btShadow_Click(object sender, EventArgs e)
        {
            //IFrameProperties pFrameProperties = pMapSurroundFrame as IFrameProperties;
            FrmFrameShadow Frm = new FrmFrameShadow(SymbolStyle, pSymbolShadow);

            Frm.ShowDialog();
            if (Frm.DialogResult == DialogResult.OK)
            {
                pSymbolShadow = Frm.GetSymbolShadow();
                if (pSymbolShadow != null)
                {
                    btShadow.Image = Frm.GetImageByGiveSymbolAfterSelectItem(btShadow.Width - 14, btShadow.Height - 14);
                    //pSymbolShadow.CornerRounding = short.Parse(txtLegendFrameAngle.Text);
                    //pSymbolShadow.HorizontalSpacing = double.Parse(this.txtLegendFrameGap.Text);
                    //pSymbolShadow.VerticalSpacing = double.Parse(this.txtLegendFrameGap.Text); ;
                    //pFrameProperties.Shadow = (IShadow)pSymbolShadow;
                }
            }
        }
Exemple #12
0
        //选择样式
        private void axSymbologyCtlFrame_OnItemSelected(object sender, ISymbologyControlEvents_OnItemSelectedEvent e)
        {
            //择样式
            pStyleGalleryItem = (IStyleGalleryItem)e.styleGalleryItem;
            if (pStyleGalleryItem != null)
            {
                SymbolShadow = pStyleGalleryItem.Item as ISymbolShadow;
                IFillSymbol pFS = SymbolShadow.FillSymbol;
                this.SizeShadowOutline.Text = pFS.Outline.Width.ToString();

                IColor pFillColor = pFS.Color;
                Color  pColorFill = ColorTranslator.FromOle(pFillColor.RGB);
                colorFill.SelectedColor = pColorFill;

                IColor pOutlineColor = pFS.Outline.Color;
                Color  pColorOutline = ColorTranslator.FromOle(pOutlineColor.RGB);
                colorOutline.SelectedColor = pColorOutline;
            }
            PreviewImage();
        }
Exemple #13
0
        private void button5_Click(object sender, EventArgs e)
        {
            Color pColor;
            frmLegendItemSymbol frmShadow         = new frmLegendItemSymbol();
            IStyleGalleryItem   pStyleGalleryItem = frmShadow.GetItem(esriSymbologyStyleClass.esriStyleClassShadows);

            if (pStyleGalleryItem != null)
            {
                m_SymbolShadow = (ISymbolShadow)pStyleGalleryItem.Item;
                pColor         = this.ConvertIRgbColorToColor(((ISymbolShadow)pStyleGalleryItem.Item).FillSymbol.Color as IRgbColor);
            }
            else
            {
                m_SymbolShadow = new SymbolShadowClass();
                pColor         = Color.White;
            }
            this.btnShadowColor.BackColor = pColor;
            IStyleGalleryClass pStyleGalleryClass = new ShadowStyleGalleryClassClass();
            Bitmap             pBitmap            = StyleGalleryItemToBmp(this.pictureBox3.Width, this.pictureBox3.Height, pStyleGalleryClass, pStyleGalleryItem);

            this.pictureBox3.Image = pBitmap as Image;
        }
Exemple #14
0
 private void btReturnShadow_Click(object sender, EventArgs e)
 {
     SymbolShadow        = null;
     this.btShadow.Image = null;
 }
Exemple #15
0
        private void FrmScaleBarAttribute_Load(object sender, EventArgs e)
        {
            if (FrmIndex == 2)
            {
                this.tabItemFrame.Visible = true;
            }
            else
            {
                this.tabItemFrame.Visible = false;
            }
            //根据加载进来的比例尺设计界面的初始值
            //格数默认值
            DivisionNum.Value    = ScaleBar.Divisions;
            SubDivisionNum.Value = ScaleBar.Subdivisions;
            //单位默认值:单位、单位位置、标签、间隔
            //单位
            if (ScaleBar.UnitLabel == "厘米")
            {
                coboBoxUnits.SelectedIndex = 0;
            }
            else if (ScaleBar.UnitLabel == "度")
            {
                coboBoxUnits.SelectedIndex = 1;
            }
            else if (ScaleBar.UnitLabel == "分米")
            {
                coboBoxUnits.SelectedIndex = 2;
            }
            else if (ScaleBar.UnitLabel == "英尺")
            {
                coboBoxUnits.SelectedIndex = 3;
            }
            else if (ScaleBar.UnitLabel == "英寸")
            {
                coboBoxUnits.SelectedIndex = 4;
            }
            else if (ScaleBar.UnitLabel == "千米" || ScaleBar.UnitLabel == "Kilometers")
            {
                coboBoxUnits.SelectedIndex = 5;
            }
            else if (ScaleBar.UnitLabel == "米" || ScaleBar.UnitLabel == "Meters")
            {
                coboBoxUnits.SelectedIndex = 6;
            }
            else if (ScaleBar.UnitLabel == "英里")
            {
                coboBoxUnits.SelectedIndex = 7;
            }
            else if (ScaleBar.UnitLabel == "毫米")
            {
                coboBoxUnits.SelectedIndex = 8;
            }
            else if (ScaleBar.UnitLabel == "海里")
            {
                coboBoxUnits.SelectedIndex = 9;
            }
            else if (ScaleBar.UnitLabel == "点")
            {
                coboBoxUnits.SelectedIndex = 10;
            }
            else if (ScaleBar.UnitLabel == "UnitsLast")
            {
                coboBoxUnits.SelectedIndex = 11;
            }
            else if (ScaleBar.UnitLabel == "UnknownUnits")
            {
                coboBoxUnits.SelectedIndex = 12;
            }
            else if (ScaleBar.UnitLabel == "码")
            {
                coboBoxUnits.SelectedIndex = 13;
            }
            else
            {
                coboBoxUnits.SelectedIndex = 12;
            }
            //coboBoxUnits.SelectedIndex = 6;

            //位置
            if (ScaleBar.UnitLabelPosition == esriScaleBarPos.esriScaleBarAfterBar)
            {
                coboBoxPos.SelectedIndex = 0;
            }
            else if (ScaleBar.UnitLabelPosition == esriScaleBarPos.esriScaleBarAbove)
            {
                coboBoxPos.SelectedIndex = 1;
            }
            else if (ScaleBar.UnitLabelPosition == esriScaleBarPos.esriScaleBarAfterLabels)
            {
                coboBoxPos.SelectedIndex = 2;
            }
            else if (ScaleBar.UnitLabelPosition == esriScaleBarPos.esriScaleBarBeforeBar)
            {
                coboBoxPos.SelectedIndex = 3;
            }
            else if (ScaleBar.UnitLabelPosition == esriScaleBarPos.esriScaleBarBeforeLabels)
            {
                coboBoxPos.SelectedIndex = 4;
            }
            else if (ScaleBar.UnitLabelPosition == esriScaleBarPos.esriScaleBarBelow)
            {
                coboBoxPos.SelectedIndex = 5;
            }
            //间隔
            UnitsGap.Value = ScaleBar.UnitLabelGap;

            //频率、频率位置、频率间隔 默认值
            if (ScaleBar.LabelFrequency == esriScaleBarFrequency.esriScaleBarDivisionsAndFirstMidpoint)
            {
                cbBoxFrequency.SelectedIndex = 0;
            }
            else if (ScaleBar.LabelFrequency == esriScaleBarFrequency.esriScaleBarDivisions)
            {
                cbBoxFrequency.SelectedIndex = 1;
            }
            else if (ScaleBar.LabelFrequency == esriScaleBarFrequency.esriScaleBarDivisionsAndFirstSubdivisions)
            {
                cbBoxFrequency.SelectedIndex = 2;
            }
            else if (ScaleBar.LabelFrequency == esriScaleBarFrequency.esriScaleBarDivisionsAndSubdivisions)
            {
                cbBoxFrequency.SelectedIndex = 3;
            }
            else if (ScaleBar.LabelFrequency == esriScaleBarFrequency.esriScaleBarMajorDivisions)
            {
                cbBoxFrequency.SelectedIndex = 4;
            }
            else if (ScaleBar.LabelFrequency == esriScaleBarFrequency.esriScaleBarNone)
            {
                cbBoxFrequency.SelectedIndex = 5;
            }
            else if (ScaleBar.LabelFrequency == esriScaleBarFrequency.esriScaleBarOne)
            {
                cbBoxFrequency.SelectedIndex = 6;
            }

            //频率位置
            if (ScaleBar.LabelPosition == esriVertPosEnum.esriAbove)
            {
                cbBoxPostion.SelectedIndex = 0;
            }
            else if (ScaleBar.LabelPosition == esriVertPosEnum.esriTop)
            {
                cbBoxPostion.SelectedIndex = 1;
            }
            else if (ScaleBar.LabelPosition == esriVertPosEnum.esriOn)
            {
                cbBoxPostion.SelectedIndex = 2;
            }
            else if (ScaleBar.LabelPosition == esriVertPosEnum.esriBottom)
            {
                cbBoxPostion.SelectedIndex = 3;
            }
            else if (ScaleBar.LabelPosition == esriVertPosEnum.esriBelow)
            {
                cbBoxPostion.SelectedIndex = 4;
            }
            //频率间距
            FrequencyGap.Value = ScaleBar.LabelGap;

            //比例尺的宽度
            BarsSize.Value = ScaleBar.BarHeight;

            IColor pScaleBarColor = ScaleBar.BarColor;
            Color  pColor         = ColorTranslator.FromOle(pScaleBarColor.RGB);

            colorBar.SelectedColor = pColor;

            //设置默认边框、背景、阴影
            IFrameProperties pFrameProperties = pMapSurroundFrame as IFrameProperties;

            if (pFrameProperties.Border != null)
            {
                FrmFrameBorder Frm = new FrmFrameBorder(SymbolStyle, (ISymbolBorder)pFrameProperties.Border);
                btBorder.Image = Frm.GetImageByGiveSymbolBeforeSelectItem(esriSymbologyStyleClass.esriStyleClassBorders, (ISymbolBorder)pFrameProperties.Border, btBorder.Width - 14, btBorder.Height - 14);
                //重新加载
                SymbolBorder             = pFrameProperties.Border as ISymbolBorder;
                this.txtBorderAngle.Text = SymbolBorder.CornerRounding.ToString();
                this.txtBorderGap.Text   = SymbolBorder.Gap.ToString();
            }
            if (pFrameProperties.Background != null)
            {
                FrmFrameBackground Frm = new FrmFrameBackground(SymbolStyle, (ISymbolBackground)pFrameProperties.Background);
                btBackground.Image = Frm.GetImageByGiveSymbolBeforeSelectItem(esriSymbologyStyleClass.esriStyleClassBackgrounds, (ISymbolBackground)pFrameProperties.Background, btBackground.Width - 14, btBackground.Height - 14);
                //重新加载
                SymbolBackground             = pFrameProperties.Background as ISymbolBackground;
                this.txtBackgroundAngle.Text = SymbolBackground.CornerRounding.ToString();
                this.txtBackgroundGap.Text   = SymbolBackground.Gap.ToString();
            }
            if (pFrameProperties.Shadow != null)
            {
                FrmFrameShadow Frm = new FrmFrameShadow(SymbolStyle, (ISymbolShadow)pFrameProperties.Shadow);
                btShadow.Image = Frm.GetImageByGiveSymbolBeforeSelectItem(esriSymbologyStyleClass.esriStyleClassShadows, (ISymbolShadow)pFrameProperties.Shadow, btShadow.Width - 14, btShadow.Height - 14);
                //重新加载
                SymbolShadow             = pFrameProperties.Shadow as ISymbolShadow;
                this.txtShadowAngle.Text = SymbolShadow.CornerRounding.ToString();
                this.txtShadowX.Text     = SymbolShadow.HorizontalSpacing.ToString();
                this.txtShadowY.Text     = SymbolShadow.VerticalSpacing.ToString();
            }
        }
Exemple #16
0
 private void button5_Click(object sender, EventArgs e)
 {
     Color pColor;
     frmLegendItemSymbol frmShadow = new frmLegendItemSymbol();
     IStyleGalleryItem pStyleGalleryItem = frmShadow.GetItem(esriSymbologyStyleClass.esriStyleClassShadows);
     if (pStyleGalleryItem != null)
     {
        m_SymbolShadow = (ISymbolShadow)pStyleGalleryItem.Item;
         pColor = this.ConvertIRgbColorToColor(((ISymbolShadow)pStyleGalleryItem.Item).FillSymbol.Color as IRgbColor);
     }
     else
     {
         m_SymbolShadow = new SymbolShadowClass();
         pColor = Color.White;
     }
     this.btnShadowColor .BackColor = pColor;
        IStyleGalleryClass pStyleGalleryClass = new ShadowStyleGalleryClassClass ();
     Bitmap pBitmap = StyleGalleryItemToBmp(this.pictureBox3.Width, this.pictureBox3.Height, pStyleGalleryClass, pStyleGalleryItem);
     this.pictureBox3.Image = pBitmap as Image;
 }
        private void FrmScaleTextAttribute_Load(object sender, EventArgs e)
        {
            if (FrmIndex == 2)
            {
                this.tabItemFrame.Visible = true;
            }
            else
            {
                this.tabItemFrame.Visible = false;
            }
            //将选择的文字比例尺的一般属性赋值给属性表
            if (ScaleText.Separator == " = ")
            {
                ckBoxAsolute.Checked  = false;
                ckBoxRelative.Checked = true;
                txtSeparator.Text     = " = ";
            }
            else if (ScaleText.Separator == ":")
            {
                ckBoxRelative.Checked   = false;
                ckBoxAsolute.Checked    = true;
                txtSeparator.Text       = ":";
                cmbBoxMapUnits.Enabled  = false;
                cmbBoxPageUnits.Enabled = false;
                txtPageLabel.Enabled    = false;
                txtMapLabel.Enabled     = false;
            }
            else if (ScaleText.Separator == " equals ")
            {
                ckBoxAsolute.Checked  = false;
                ckBoxRelative.Checked = true;
                txtSeparator.Text     = " equals ";
            }
            //布局
            if (ScaleText.PageUnitLabel == "in" || ScaleText.PageUnitLabel == "inch")
            {
                cmbBoxPageUnits.SelectedIndex = 1;
            }
            else if (ScaleText.PageUnitLabel == "cm" || ScaleText.PageUnitLabel == "centimeter" || ScaleText.PageUnitLabel == "page unit")
            {
                cmbBoxPageUnits.SelectedIndex = 0;
            }
            //地图
            if (ScaleText.MapUnitLabel == "feet" || ScaleText.MapUnitLabel == "ft")
            {
                cmbBoxMapUnits.SelectedIndex = 3;
            }
            else if (ScaleText.MapUnitLabel == "miles")
            {
                cmbBoxMapUnits.SelectedIndex = 7;
            }
            else if (ScaleText.MapUnitLabel == "km")
            {
                cmbBoxMapUnits.SelectedIndex = 5;
            }
            else if (ScaleText.MapUnitLabel == "meters")
            {
                cmbBoxMapUnits.SelectedIndex = 6;
            }
            else if (ScaleText.MapUnitLabel == "yards")
            {
                cmbBoxMapUnits.SelectedIndex = 12;
            }
            else if (ScaleText.MapUnitLabel == "map units")
            {
                cmbBoxMapUnits.SelectedIndex = 11;
            }

            //字体名称加载
            //加载字体名称
            InstalledFontCollection pFontCollection = new InstalledFontCollection();

            FontFamily[] pFontFamily = pFontCollection.Families;
            for (int i = 0; i < pFontFamily.Length; i++)
            {
                string pFontName = pFontFamily[i].Name;
                this.cboBoxFontName.Items.Add(pFontName);
            }
            this.cboBoxFontName.Text = "宋体";
            //加载字体大小
            for (int i = 3; i <= 100; i++)
            {
                this.cboBoxFontSize.Items.Add(i.ToString());
            }
            this.cboBoxFontSize.Text = "15";
            //颜色
            FontColor.SelectedColor = Color.Black;
            //设置默认边框、背景、阴影
            IFrameProperties pFrameProperties = pMapSurroundFrame as IFrameProperties;

            if (pFrameProperties.Border != null)
            {
                FrmFrameBorder Frm = new FrmFrameBorder(SymbolStyle, (ISymbolBorder)pFrameProperties.Border);
                btBorder.Image = Frm.GetImageByGiveSymbolBeforeSelectItem(esriSymbologyStyleClass.esriStyleClassBorders, (ISymbolBorder)pFrameProperties.Border, btBorder.Width - 14, btBorder.Height - 14);
                //重新加载
                SymbolBorder             = pFrameProperties.Border as ISymbolBorder;
                this.txtBorderAngle.Text = SymbolBorder.CornerRounding.ToString();
                this.txtBorderGap.Text   = SymbolBorder.Gap.ToString();
            }
            if (pFrameProperties.Background != null)
            {
                FrmFrameBackground Frm = new FrmFrameBackground(SymbolStyle, (ISymbolBackground)pFrameProperties.Background);
                btBackground.Image = Frm.GetImageByGiveSymbolBeforeSelectItem(esriSymbologyStyleClass.esriStyleClassBackgrounds, (ISymbolBackground)pFrameProperties.Background, btBackground.Width - 14, btBackground.Height - 14);
                //重新加载
                SymbolBackground             = pFrameProperties.Background as ISymbolBackground;
                this.txtBackgroundAngle.Text = SymbolBackground.CornerRounding.ToString();
                this.txtBackgroundGap.Text   = SymbolBackground.Gap.ToString();
            }
            if (pFrameProperties.Shadow != null)
            {
                FrmFrameShadow Frm = new FrmFrameShadow(SymbolStyle, (ISymbolShadow)pFrameProperties.Shadow);
                btShadow.Image = Frm.GetImageByGiveSymbolBeforeSelectItem(esriSymbologyStyleClass.esriStyleClassShadows, (ISymbolShadow)pFrameProperties.Shadow, btShadow.Width - 14, btShadow.Height - 14);
                //重新加载
                SymbolShadow             = pFrameProperties.Shadow as ISymbolShadow;
                this.txtShadowAngle.Text = SymbolShadow.CornerRounding.ToString();
                this.txtShadowX.Text     = SymbolShadow.HorizontalSpacing.ToString();
                this.txtShadowY.Text     = SymbolShadow.VerticalSpacing.ToString();
            }
        }
        private void FrmLegendAttribute_Load(object sender, EventArgs e)
        {
            //图例界面要素信息加载

            ILegendFormat pLegendFormat = Legend.Format;

            //标题
            this.txtLegendTitle.Text = Legend.Title;
            if (pLegendFormat.ShowTitle == true)
            {
                this.cBoxShowTitle.Checked  = true;
                this.txtLegendTitle.Enabled = true;
            }
            else
            {
                this.cBoxShowTitle.Checked  = false;
                this.txtLegendTitle.Enabled = false;
            }
            pTitleSymbol = pLegendFormat.TitleSymbol;
            //图面
            this.txtPatchWith.Text   = pLegendFormat.DefaultPatchWidth.ToString();
            this.txtPatchHeight.Text = pLegendFormat.DefaultPatchHeight.ToString();

            if (pLegendFormat.DefaultLinePatch != null)
            {
                FrmPatchLineAndArea frmPatchLine = new FrmPatchLineAndArea(esriSymbologyStyleClass.esriStyleClassLinePatches);
                this.btLineShape.Image = frmPatchLine.GetImageByGiveLineSymbolBeforeSelectItem(esriSymbologyStyleClass.esriStyleClassLinePatches, (ILinePatch)pLegendFormat.DefaultLinePatch, btLineShape.Width, btLineShape.Height);
            }
            if (pLegendFormat.DefaultAreaPatch != null)
            {
                FrmPatchLineAndArea frmPatchArea = new FrmPatchLineAndArea(esriSymbologyStyleClass.esriStyleClassAreaPatches);
                this.btAreaShape.Image = frmPatchArea.GetImageByGiveAreaSymbolBeforeSelectItem(esriSymbologyStyleClass.esriStyleClassAreaPatches, (IAreaPatch)pLegendFormat.DefaultAreaPatch, btAreaShape.Width, btAreaShape.Height);
            }

            //间隔
            this.txtTitleAndLegend.Text       = pLegendFormat.TitleGap.ToString();
            this.txtLegendItems.Text          = pLegendFormat.VerticalItemGap.ToString();
            this.txtColumns.Text              = pLegendFormat.HorizontalItemGap.ToString();
            this.txtLabelsAndDescription.Text = pLegendFormat.TextGap.ToString();
            this.txtHeadings.Text             = pLegendFormat.HeadingGap.ToString();
            this.txtPatchesV.Text             = pLegendFormat.VerticalPatchGap.ToString();
            this.txtPatchAndLabels.Text       = pLegendFormat.HorizontalPatchGap.ToString();

            //图层加载
            if (pMap.LayerCount > 0)
            {
                for (int i = 0; i < pMap.LayerCount; i++)
                {
                    //将所有数据名称加载到ListView中
                    this.LViewMapLayer.Items.Add(pMap.get_Layer(i).Name);

                    for (int j = 0; j < Legend.ItemCount; j++)
                    {
                        ILegendItem pLegendItem = Legend.Item[j];
                        if (pMap.get_Layer(i).Name == pLegendItem.Layer.Name)
                        {
                            this.LViewLegendLayer.Items.Add(pLegendItem.Layer.Name);
                            pSelectedidx.Add(i);
                        }
                    }
                }
            }

            //各类文本样式
            ILegendItem pLegendItem0 = Legend.Item[0];

            pLayerNameSymbol = pLegendItem0.LayerNameSymbol;
            pHeadingSymbol   = pLegendItem0.HeadingSymbol;
            ILegendClassFormat pLegendClassFormat = pLegendItem0.LegendClassFormat;

            pLabelSymbol       = pLegendClassFormat.LabelSymbol;
            pDescriptionSymbol = pLegendClassFormat.DescriptionSymbol;

            ////图例列数
            //ILegendItem pLegendItemff = new HorizontalLegendItemClass();
            //this.LegendColumn.Text = pLegendItemff.Columns.ToString ();
            //文本样式下拉列表
            this.cboBoxTextSymbol.SelectedIndex = 0;

            cBoxAddVisibleLayer.Checked = Legend.AutoVisibility; //只显示显示的图层
            cBoxAddNewLayer.Checked     = Legend.AutoAdd;        //自动添加显示的图层
            cBoxNewOrder.Checked        = Legend.AutoReorder;    //按照图层顺序排列图例

            //地图框架
            IFrameProperties pFrameProperties = pMapSurroundFrame as IFrameProperties;

            if (pMapSurroundFrame.Border != null)
            {
                FrmFrameBorder frm = new FrmFrameBorder(SymbolStyle, (ISymbolBorder)pMapSurroundFrame.Border);

                if (btBorder.Image != null)
                {
                    btBorder.Image.Dispose();
                }
                this.btBorder.Image = frm.GetImageByGiveSymbolBeforeSelectItem(esriSymbologyStyleClass.esriStyleClassBorders, (ISymbolBorder)pMapSurroundFrame.Border, btBorder.Width, btBorder.Height);
                pSymbolBorder       = pFrameProperties.Border as ISymbolBorder;
                txtBorderGap.Text   = pFrameProperties.Border.Gap.ToString();
                txtBorderAngle.Text = pSymbolBorder.CornerRounding.ToString();
            }
            if (pMapSurroundFrame.Background != null)
            {
                FrmFrameBackground frm = new FrmFrameBackground(SymbolStyle, (ISymbolBackground)pMapSurroundFrame.Background);

                if (btBackground.Image != null)
                {
                    btBackground.Image.Dispose();
                }
                this.btBackground.Image = frm.GetImageByGiveSymbolBeforeSelectItem(esriSymbologyStyleClass.esriStyleClassBackgrounds, (ISymbolBackground)pMapSurroundFrame.Background, btBackground.Width, btBackground.Height);

                pSymbolBackground       = pFrameProperties.Background as ISymbolBackground;
                txtBackgroundGap.Text   = pSymbolBackground.Gap.ToString();
                txtBackgroundAngle.Text = pSymbolBackground.CornerRounding.ToString();
            }
            if (pFrameProperties.Shadow != null)
            {
                FrmFrameShadow frm = new FrmFrameShadow(SymbolStyle, (ISymbolShadow)pFrameProperties.Shadow);

                if (btShadow.Image != null)
                {
                    btShadow.Image.Dispose();
                }
                this.btShadow.Image = frm.GetImageByGiveSymbolBeforeSelectItem(esriSymbologyStyleClass.esriStyleClassShadows, (ISymbolShadow)pFrameProperties.Shadow, btShadow.Width, btShadow.Height);

                pSymbolShadow       = pFrameProperties.Shadow as ISymbolShadow;
                txtShadowX.Text     = pSymbolShadow.HorizontalSpacing.ToString();
                txtShadowY.Text     = pSymbolShadow.VerticalSpacing.ToString();
                txtShadowAngle.Text = pSymbolShadow.CornerRounding.ToString();
            }
        }
Exemple #19
0
        private void LegendWizard_Load(object sender, EventArgs e)
        {
            if (m_pageLayoutControl.ActiveView.FocusMap == null)
            {
                MessageBox.Show("请先添加地图");
                return;
            }
            #region                       //点击 添加图例按钮 或在 PageLayoutControl中双击图例时
            if (mapSurroundFrame == null) //当点击 添加图例按钮 或在 PageLayoutControl中双击图例时 先创建图例 或从地图上获得已经添加的图例;
            {
                //Get the GraphicsContainer
                IGraphicsContainer graphicsContainer = m_pageLayoutControl.GraphicsContainer;
                graphicsContainer.Reset();
                IElementProperties pElementPerties = graphicsContainer.Next() as IElementProperties;
                //Get the MapFrame
                IMapFrame mapFrame = (IMapFrame)graphicsContainer.FindFrame(m_pageLayoutControl.ActiveView.FocusMap);
                if (mapFrame == null)
                {
                    return;
                }
                while (pElementPerties != null) //从地图中获得已有的图例
                {
                    if (pElementPerties.Type == "Map Surround Frame")
                    {
                        pMapSurrounFrame = pElementPerties as IMapSurroundFrame;
                        if (pMapSurrounFrame.MapSurround.Name == "Legend")
                        {
                            m_legend = pMapSurrounFrame.MapSurround as ILegend;
                            break;
                        }
                    }
                    pElementPerties = (IElementProperties)graphicsContainer.Next();
                }
                if (m_legend == null) //当地图中没有添加图例时 创建新图例
                {
                    //Create a legend
                    UID uID = new UIDClass();
                    uID.Value = "esriCarto.Legend";

                    //Create a MapSurroundFrame from the MapFrame
                    mapSurroundFrame = mapFrame.CreateSurroundFrame(uID, null);

                    if (mapSurroundFrame == null)
                    {
                        return;
                    }
                    if (mapSurroundFrame.MapSurround == null)
                    {
                        return;
                    }

                    m_legend = mapSurroundFrame.MapSurround as ILegend;
                }
                else
                {
                    mapSurroundFrame = pMapSurrounFrame;
                }



                UID m_uid = new UIDClass();
                m_uid.Value = "{34C20002-4D3C-11D0-92D8-00805F7C28B0}";
                m_mapLayers = m_mapControl.Map as IMapLayers;
                m_emuLayer  = m_mapLayers.get_Layers(m_uid, true);//获取图层
                if (m_emuLayer != null)
                {
                    m_emuLayer.Reset();
                    ILayer m_layer = null;
                    while ((m_layer = m_emuLayer.Next()) != null)
                    {
                        this.listBox1.Items.Add(m_layer.Name);//将图层名添加到图例备选项中
                    }
                }
            }
            #endregion
            else //在双击任意范围打印框中图例时,获得图例,及图层信息;
            {
                if (m_Map == null)
                {
                    MessageBox.Show("请先添加地图!");
                }
                for (int k = 0; k < m_Map.LayerCount; k++)
                {
                    listBox1.Items.Add(m_Map.get_Layer(k).Name.ToString());
                }
                m_legend = mapSurroundFrame.MapSurround as ILegend;
            }
            //以下设置需要用到的变量 及初始化 对话框
            plegendFormat = m_legend.Format as ILegendFormat; //设置图例格式需要用到的

            pTextSymbol      = new TextSymbolClass();
            pTextSymbol.Size = 10;
            pTextSymbol.HorizontalAlignment = esriTextHorizontalAlignment.esriTHALeft; //初始化图例标签的文本格式

            if (m_legend.Title != null)
            {
                textBox1.Text = m_legend.Title.ToString(); //初始化对话框中的文本框 文本
            }
            else
            {
                textBox1.Text = "Legend";
            }

            this.textBoxWidth.Text  = "36";
            this.textBoxHeight.Text = "15";
            IMapSurround mapSurround = m_legend as IMapSurround;
            mapSurroundFrame.MapSurround = mapSurround;
            m_FrameProperties            = (IFrameProperties)mapSurroundFrame;
            ISymbolBackground pSymbolBack   = m_FrameProperties.Background as ISymbolBackground;
            ISymbolBorder     pSymbolBorder = m_FrameProperties.Border as ISymbolBorder;
            ISymbolShadow     pSymbolShadow = m_FrameProperties.Shadow as ISymbolShadow;
            if (pSymbolBack != null)
            {
                this.btnBackGroundColor.BackColor = ColorTranslator.FromOle(pSymbolBack.FillSymbol.Color.RGB);
            }
            if (pSymbolBorder != null)
            {
                this.btnBolderColor.BackColor = ColorTranslator.FromOle(pSymbolBorder.LineSymbol.Color.RGB);
            }
            if (pSymbolShadow != null)
            {
                this.btnShadowColor.BackColor = ColorTranslator.FromOle(pSymbolShadow.FillSymbol.Color.RGB);
            }
        }
Exemple #20
0
        //选择样式前返回图片
        public Image GetImageByGiveSymbolBeforeSelectItem(esriSymbologyStyleClass styleClass, ISymbolShadow symbol, int width, int height)
        {
            axSymbologyCtlFrame.StyleClass = styleClass;
            ISymbologyStyleClass symbologyStyleClass = axSymbologyCtlFrame.GetStyleClass(styleClass);

            IStyleGalleryItem styleGalleryItem = new ServerStyleGalleryItem();

            styleGalleryItem.Item = symbol;
            symbologyStyleClass.AddItem(styleGalleryItem, 0);
            symbologyStyleClass.SelectItem(0);
            stdole.IPictureDisp  picture = symbologyStyleClass.PreviewItem(pStyleGalleryItem, width, height);
            System.Drawing.Image image   = System.Drawing.Image.FromHbitmap(new System.IntPtr(picture.Handle));
            return(image);
        }