private void method_0() { this.m_pMapGrid = new MeasuredGridClass(); if (this.imapFrame_0 != null) { this.m_pMapGrid.SetDefaults(this.imapFrame_0); } (this.m_pMapGrid as IMeasuredGrid).XOrigin = 0.0; (this.m_pMapGrid as IMeasuredGrid).Units = esriUnits.esriMeters; (this.m_pMapGrid as IMeasuredGrid).YOrigin = 0.0; (this.m_pMapGrid as IMeasuredGrid).XIntervalSize = 200.0; (this.m_pMapGrid as IMeasuredGrid).YIntervalSize = 200.0; (this.m_pMapGrid as IMeasuredGrid).FixedOrigin = true; IGridLabel labelFormat = this.m_pMapGrid.LabelFormat; ITextSymbol symbol = new TextSymbolClass { Font = labelFormat.Font, Color = labelFormat.Color, Text = labelFormat.DisplayName, VerticalAlignment = esriTextVerticalAlignment.esriTVABottom }; labelFormat.Font = symbol.Font; labelFormat.Color = symbol.Color; labelFormat.LabelOffset = 6.0; this.m_pMapGrid.LabelFormat = labelFormat; if (labelFormat is IMixedFontGridLabel2) { (labelFormat as IMixedFontGridLabel2).NumGroupedDigits = 0; } }
private static IGridLabel CreateMixedFontGridLabel() { IMixedFontGridLabel mixedFontGridLabelClass = new MixedFontGridLabel() as IMixedFontGridLabel; IGridLabel gridLabel = mixedFontGridLabelClass as IGridLabel; IFontDisp stdFontClass = new StdFont() as IFontDisp; stdFontClass.Name = "Arial"; stdFontClass.Size = new decimal(16); gridLabel.Font = stdFontClass; gridLabel.Color = CartoHelper.BuildRGB(0, 0, 0); gridLabel.LabelOffset = 2; gridLabel.LabelAlignment[esriGridAxisEnum.esriGridAxisLeft] = false; gridLabel.LabelAlignment[esriGridAxisEnum.esriGridAxisRight] = false; stdFontClass = new StdFont() as IFontDisp; stdFontClass.Name = "Arial"; stdFontClass.Size = new decimal(12); mixedFontGridLabelClass.SecondaryFont = stdFontClass; mixedFontGridLabelClass.SecondaryColor = CartoHelper.BuildRGB(0, 0, 0); mixedFontGridLabelClass.NumGroupedDigits = 6; IFormattedGridLabel formattedGridLabel = mixedFontGridLabelClass as IFormattedGridLabel; INumericFormat format = new NumericFormat() as INumericFormat; format.AlignmentOption = esriNumericAlignmentEnum.esriAlignRight; format.RoundingOption = esriRoundingOptionEnum.esriRoundNumberOfDecimals; format.RoundingValue = 2; format.ShowPlusSign = true; format.UseSeparator = false; format.ZeroPad = true; INumericFormat numericFormatClass = format as INumericFormat; formattedGridLabel.Format = numericFormatClass as INumberFormat; return(gridLabel); }
private void cboFormat_SelectedIndexChanged(object sender, EventArgs e) { if (this.m_CanDo) { if (this.cboFormat.SelectedIndex == 0) { this.pGridLabel = new FormattedGridLabelClass(); } else if (this.cboFormat.SelectedIndex == 1) { this.pGridLabel = new MixedFontGridLabelClass(); } else { this.pGridLabel = new DMSGridLabelClass(); } this.m_CanDo = false; this.SetGridLabel(); this.m_CanDo = false; this.m_IsPageDirty = true; if (this.OnValueChange != null) { this.OnValueChange(); } } }
private void LabelFormatPropertyPage_Load(object sender, EventArgs e) { if (GridAxisPropertyPage.m_pMapGrid != null) { bool leftVis = false; bool topVis = false; bool rightVis = false; bool bottomVis = false; GridAxisPropertyPage.m_pMapGrid.QueryLabelVisibility(ref leftVis, ref topVis, ref rightVis, ref bottomVis); this.chkLabelBottom.Checked = bottomVis; this.chkLabelLeft.Checked = leftVis; this.chkLabelRight.Checked = rightVis; this.chkLabelTop.Checked = topVis; this.pGridLabel = GridAxisPropertyPage.m_pMapGrid.LabelFormat; if (this.pGridLabel is IMixedFontGridLabel2) { this.cboFormat.SelectedIndex = 1; } else if (this.pGridLabel is IFormattedGridLabel) { this.cboFormat.SelectedIndex = 0; } else { this.cboFormat.SelectedIndex = 2; } this.SetGridLabel(); this.m_CanDo = true; } }
private void cboFormat_SelectedIndexChanged(object sender, EventArgs e) { if (this.bool_0) { if (this.cboFormat.SelectedIndex == 0) { this.igridLabel_0 = new FormattedGridLabelClass(); } else if (this.cboFormat.SelectedIndex == 1) { this.igridLabel_0 = new MixedFontGridLabelClass(); } else { this.igridLabel_0 = new DMSGridLabelClass(); } this.bool_0 = false; this.method_4(); this.bool_0 = false; this.bool_1 = true; if (this.OnValueChange != null) { this.OnValueChange(); } } }
private void cboLabelType_SelectedIndexChanged(object sender, EventArgs e) { if (this.bool_0) { switch (this.cboLabelType.SelectedIndex) { case 0: this.igridLabel_0 = new ButtonTabStyleClass(); break; case 1: this.igridLabel_0 = new BackgroundTabStyleClass(); break; case 2: this.igridLabel_0 = new ContinuousTabStyleClass(); break; case 3: this.igridLabel_0 = new RoundedTabStyleClass(); break; } this.iindexGrid_0.LabelFormat = this.igridLabel_0; } }
private void LabelFormatPropertyPage_Load(object sender, EventArgs e) { this.m_pMapGrid = this.MapTemplate.MapGrid; if (this.m_pMapGrid != null) { bool leftVis = false; bool topVis = false; bool rightVis = false; bool bottomVis = false; this.m_pMapGrid.QueryLabelVisibility(ref leftVis, ref topVis, ref rightVis, ref bottomVis); this.chkLabelBottom.Checked = bottomVis; this.chkLabelLeft.Checked = leftVis; this.chkLabelRight.Checked = rightVis; this.chkLabelTop.Checked = topVis; this.igridLabel_0 = this.m_pMapGrid.LabelFormat; if (this.igridLabel_0 is IMixedFontGridLabel2) { this.cboFormat.SelectedIndex = 1; } else if (this.igridLabel_0 is IFormattedGridLabel) { this.cboFormat.SelectedIndex = 0; } else { this.cboFormat.SelectedIndex = 2; } this.method_4(); this.bool_0 = true; } }
public void CreateGrid(IActiveView activeView, IPageLayout pageLayout) { IMapGrid mapGrid = new GraticuleClass(); mapGrid.Name = "Map Grid"; IColor color = new RgbColorClass(); color.RGB = 0XBBBBBB; ICartographicLineSymbol cartographicLineSymbol = new CartographicLineSymbolClass(); cartographicLineSymbol.Cap = esriLineCapStyle.esriLCSButt; cartographicLineSymbol.Color = color; cartographicLineSymbol.Width = 2; mapGrid.LineSymbol = (ILineSymbol)cartographicLineSymbol; mapGrid.Border = null; mapGrid.TickLength = 15; cartographicLineSymbol = new CartographicLineSymbolClass(); cartographicLineSymbol.Cap = esriLineCapStyle.esriLCSButt; cartographicLineSymbol.Color = color; cartographicLineSymbol.Width = 1; mapGrid.TickLineSymbol = (ILineSymbol)cartographicLineSymbol; mapGrid.TickMarkSymbol = null; mapGrid.SubTickCount = 5; mapGrid.SubTickLength = 10; cartographicLineSymbol = new CartographicLineSymbolClass(); cartographicLineSymbol.Cap = esriLineCapStyle.esriLCSButt; cartographicLineSymbol.Color = color; cartographicLineSymbol.Width = 0.2; mapGrid.SubTickLineSymbol = (ILineSymbol)cartographicLineSymbol; IGridLabel gridLabel = mapGrid.LabelFormat; gridLabel.LabelOffset = 15; mapGrid.SetTickVisibility(true, true, true, true); mapGrid.SetSubTickVisibility(true, true, true, true); mapGrid.SetLabelVisibility(true, true, true, true); mapGrid.Visible = true; IMeasuredGrid measuredGrid = mapGrid as IMeasuredGrid; measuredGrid.FixedOrigin = true; measuredGrid.XIntervalSize = 10; measuredGrid.XOrigin = 5; //Shift grid 5 measuredGrid.YIntervalSize = 10; //Parallel interval. measuredGrid.YOrigin = 5; //Shift grid 5 IMap map = activeView.FocusMap; IGraphicsContainer graphicsContainer = pageLayout as IGraphicsContainer; IFrameElement frameElement = graphicsContainer.FindFrame(map); IMapFrame mapFrame = frameElement as IMapFrame; IMapGrids mapGrids = null; mapGrids = mapFrame as IMapGrids; mapGrids.AddMapGrid(mapGrid); activeView.PartialRefresh(esriViewDrawPhase.esriViewBackground, null, null); }
private void btnFont_Click(object sender, EventArgs e) { try { frmSymbolSelector selector = new frmSymbolSelector(); selector.SetStyleGallery(this.istyleGallery_0); selector.SetSymbol(this.itextSymbol_0); if (selector.ShowDialog() == DialogResult.OK) { IGridLabel labelFormat = this.iindexGrid_0.LabelFormat; labelFormat.Font = this.itextSymbol_0.Font; labelFormat.Color = this.itextSymbol_0.Color; this.iindexGrid_0.LabelFormat = labelFormat; } } catch { } }
public void Init() { this.bool_0 = false; if (this.imapGrid_0 != null) { this.btnMainLineStyle.Style = this.imapGrid_0.TickLineSymbol; this.btnSubLineStyle.Style = this.imapGrid_0.SubTickLineSymbol; bool leftVis = false; bool rightVis = false; bool topVis = false; bool bottomVis = false; this.imapGrid_0.QueryTickVisibility(ref leftVis, ref topVis, ref rightVis, ref bottomVis); this.chkTickVisibility.Checked = leftVis; this.btnMainLineStyle.Enabled = leftVis; this.imapGrid_0.QuerySubTickVisibility(ref leftVis, ref topVis, ref rightVis, ref bottomVis); this.chkSubTickVisibility.Checked = leftVis; this.btnSubLineStyle.Enabled = leftVis; this.spinSubTickCount.Enabled = leftVis; this.spinSubTickCount.Value = this.imapGrid_0.SubTickCount; IGridLabel labelFormat = this.imapGrid_0.LabelFormat; this.itextSymbol_0.Font = labelFormat.Font; this.itextSymbol_0.Color = labelFormat.Color; this.itextSymbol_0.Text = labelFormat.DisplayName; this.styleButton1.Style = this.itextSymbol_0; if (labelFormat is IMixedFontGridLabel) { (labelFormat as IMixedFontGridLabel).NumGroupedDigits = 2; this.imapGrid_0.LabelFormat = labelFormat; } if (labelFormat is IFormattedGridLabel) { INumericFormat format = new NumericFormatClass { RoundingValue = 0 }; (labelFormat as IFormattedGridLabel).Format = format as INumberFormat; this.imapGrid_0.LabelFormat = labelFormat; } } this.bool_0 = true; }
private void styleButton1_Click(object sender, EventArgs e) { try { frmSymbolSelector selector = new frmSymbolSelector(); selector.SetStyleGallery(this.istyleGallery_0); selector.SetSymbol(this.itextSymbol_0); if (selector.ShowDialog() == DialogResult.OK) { object symbol = selector.GetSymbol(); this.itextSymbol_0 = symbol as ITextSymbol; IGridLabel labelFormat = this.imapGrid_0.LabelFormat; labelFormat.Font = this.itextSymbol_0.Font; labelFormat.Color = this.itextSymbol_0.Color; this.imapGrid_0.LabelFormat = labelFormat; this.styleButton1.Style = this.itextSymbol_0; } } catch { } }