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 } }
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(); } }
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(); } }
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(); } }