private void UpdateDecorationControls() { _ignoreChanges = true; ILineDecoration decoration = ccDecorations.SelectedDecoration; if (decoration != null) { chkFlipAll.Checked = decoration.FlipAll; chkFlipFirst.Checked = decoration.FlipFirst; if (decoration.RotateWithLine) { radRotationWithLine.Checked = true; } else { radRotationFixed.Checked = true; } nudDecorationCount.Value = decoration.NumSymbols; nudPercentualPosition.Value = decoration.PercentualPosition; nudPercentualPosition.Visible = decoration.NumSymbols == 1; lblPercentualPosition.Visible = decoration.NumSymbols == 1; dblOffset.Value = decoration.Offset; } _ignoreChanges = false; }
private void UpdateDecorationPreview(Graphics g) { ILineDecoration dec = ccDecorations.SelectedDecoration; if (dec != null) { dec.Symbol.Draw(g, lblDecorationPreview.ClientRectangle); } }
private void BtnUpClick(object sender, EventArgs e) { ILineDecoration lineDecoration = lbxItems.SelectedItem as ILineDecoration; if (lineDecoration == null) { return; } _decorations.IncreaseIndex(lineDecoration); RefreshList(); lbxItems.SelectedItem = lineDecoration; OnOrderChanged(); }
private void BtnEditClick(object sender, EventArgs e) { ILineDecoration dec = ccDecorations.SelectedDecoration; if (dec == null) { return; } DetailedPointSymbolDialog dpd = new(dec.Symbol); dpd.ChangesApplied += DpdChangesApplied; dpd.ShowDialog(); }
private void radRotationWithLine_CheckedChanged(object sender, EventArgs e) { if (_ignoreChanges) { return; } ILineDecoration dec = ccDecorations.SelectedDecoration; if (dec != null) { dec.RotateWithLine = radRotationWithLine.Checked; } UpdatePreview(); }
/// <summary> /// Update the selected linedecoration: set the percentual position between line start and end of the single decoration. /// </summary> private void nudPercentualPosition_ValueChanged(object sender, EventArgs e) { if (_ignoreChanges) { return; } ILineDecoration dec = ccDecorations.SelectedDecoration; if (dec != null) { dec.PercentualPosition = (int)nudPercentualPosition.Value; } UpdatePreview(); }
/// <summary> /// Update the selected linedecoration: set whether the first decoration should be flipped. /// </summary> private void chkFlipFirst_CheckedChanged(object sender, EventArgs e) { if (_ignoreChanges) { return; } ILineDecoration dec = ccDecorations.SelectedDecoration; if (dec != null) { dec.FlipFirst = chkFlipFirst.Checked; } UpdatePreview(); }
private void nudDecorationCount_ValueChanged(object sender, EventArgs e) { if (_ignoreChanges) { return; } ILineDecoration dec = ccDecorations.SelectedDecoration; if (dec != null) { dec.NumSymbols = (int)nudDecorationCount.Value; } UpdatePreview(); }
private void RadPositionCheckedChanged(object sender, EventArgs e) { if (_ignoreChanges) { return; } ILineDecoration dec = ccDecorations.SelectedDecoration; if (dec != null) { dec.UseSpacing = radSpacing.Checked; } UpdatePreview(); }
private void NudDecorationCountValueChanged(object sender, EventArgs e) { nudPercentualPosition.Visible = nudDecorationCount.Value == 1; lblPercentualPosition.Visible = nudDecorationCount.Value == 1; if (_ignoreChanges) { return; } ILineDecoration dec = ccDecorations.SelectedDecoration; if (dec != null) { dec.NumSymbols = (int)nudDecorationCount.Value; } UpdatePreview(); }
private void CmbSpacingUnitSelectedIndexChanged(object sender, EventArgs e) { if (_ignoreChanges) { return; } ILineDecoration dec = ccDecorations.SelectedDecoration; if (dec != null) { if (float.TryParse(dbSpacing.Text, out float fValue) && fValue > 0) { dec.Spacing = fValue; dec.SpacingUnit = cmbSpacingUnit.SelectedItem.ToString(); } } UpdatePreview(); }
private void btnRemove_Click(object sender, EventArgs e) { if (lbxItems.SelectedItem == null) { return; } ILineDecoration lineDecoration = lbxItems.SelectedItem as ILineDecoration; int index = _decorations.IndexOf(lineDecoration); _decorations.Remove(lineDecoration); RefreshList(); if (_decorations.Count == 0) { return; } if (index >= _decorations.Count) { index -= 1; } lbxItems.SelectedIndex = index; OnRemoveClick(); }
private void LbxItemsDrawItem(object sender, DrawItemEventArgs e) { Rectangle outer = new Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height); if ((e.State & DrawItemState.Selected) == DrawItemState.Selected) { e.Graphics.FillRectangle(SystemBrushes.Highlight, outer); } else { Brush b = new SolidBrush(BackColor); e.Graphics.FillRectangle(b, outer); b.Dispose(); } Rectangle inner = new Rectangle(e.Bounds.X + 5, e.Bounds.Y + 1, e.Bounds.Width - 10, e.Bounds.Height - 3); e.Graphics.FillRectangle(Brushes.White, inner); e.Graphics.DrawRectangle(Pens.Black, inner); int index = (e.Index < 0) ? 0 : e.Index; if (lbxItems.Items.Count == 0) { return; } ILineDecoration lineDecoration = lbxItems.Items[index] as ILineDecoration; if (lineDecoration == null) { return; } GraphicsPath gp = new GraphicsPath(); gp.AddLine(new Point(e.Bounds.X + 10, e.Bounds.Y + (e.Bounds.Height / 2)), new Point(e.Bounds.Width - 10, e.Bounds.Y + (e.Bounds.Height / 2))); lineDecoration.Draw(e.Graphics, gp, 1); gp.Dispose(); }
private void UpdateDecorationControls() { _ignoreChanges = true; ILineDecoration decoration = ccDecorations.SelectedDecoration; if (decoration != null) { chkFlipAll.Checked = decoration.FlipAll; chkFlipFirst.Checked = decoration.FlipFirst; if (decoration.RotateWithLine) { radRotationWithLine.Checked = true; } else { radRotationFixed.Checked = true; } nudDecorationCount.Value = decoration.NumSymbols; nudPercentualPosition.Value = decoration.PercentualPosition; nudPercentualPosition.Visible = decoration.NumSymbols == 1; lblPercentualPosition.Visible = decoration.NumSymbols == 1; dblOffset.Value = decoration.Offset; if (decoration.UseSpacing) { radSpacing.Checked = true; } else { radNumberOfPositions.Checked = true; } dbSpacing.Text = decoration.Spacing.ToString(); cmbSpacingUnit.SelectedItem = decoration.SpacingUnit; } _ignoreChanges = false; }
//线 设计 private void colorLine_SelectedColorChanged(object sender, EventArgs e) { if (pStyleGalleryItem == null) { MessageBox.Show("请选择线样式", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } ILineSymbol pLineSymbol = pStyleGalleryItem.Item as ILineSymbol; if (pLineSymbol == null) { return; } pLineSymbol.Color = ClsGDBDataCommon.ColorToIColor(colorLine.SelectedColor); //新添加,用于更改线修饰颜色 if (pLineSymbol is IMultiLayerLineSymbol) { IMultiLayerLineSymbol pMultiLyerLine = pLineSymbol as IMultiLayerLineSymbol; int nLCount = pMultiLyerLine.LayerCount; for (int j = 0; j < nLCount; j++) { ILineSymbol Psymbol = pMultiLyerLine.get_Layer(j); ILineProperties pLineProp = Psymbol as ILineProperties; List <ILineDecorationElement> Linedeclist = new List <ILineDecorationElement>(); if (pLineProp != null) { ILineDecoration pLineDec = pLineProp.LineDecoration; if (pLineDec != null) { int ncount = pLineDec.ElementCount; for (int i = 0; i < ncount; i++) { ILineDecorationElement pLineDecEle = pLineDec.get_Element(i); Linedeclist.Add(pLineDecEle); } if (Linedeclist.Count > 0) { for (int i = 0; i < ncount; i++) { ISimpleLineDecorationElement pSLDecEle = Linedeclist[i] as ISimpleLineDecorationElement; ISimpleLineDecorationElement pnewele = new SimpleLineDecorationElementClass(); if (pSLDecEle != null) { IMarkerSymbol pMSymbol = pSLDecEle.MarkerSymbol; pMSymbol.Color = ClsGDBDataCommon.ColorToIColor(colorLine.SelectedColor); pnewele.AddPosition(pSLDecEle.get_Position(i)); pnewele.MarkerSymbol = pMSymbol; pLineDec.DeleteElement(i); pLineDec.AddElement(pnewele); } } } } } } } PreviewImage(); }