public EditRulerForm(LayerRuler.RulerItem rulerItem) { InitializeComponent(); // clone the specified ruler in a new instance that will receive the edited properties mEditedRulerClone = rulerItem.Clone() as LayerRuler.RulerItem; // set the different control with the current state of the ruler // line appearance this.lineThicknessNumericUpDown.Value = (decimal)(rulerItem.LineThickness); this.lineColorPictureBox.BackColor = rulerItem.Color; if (rulerItem is LayerRuler.LinearRuler) this.allowOffsetCheckBox.Checked = (rulerItem as LayerRuler.LinearRuler).AllowOffset; else this.allowOffsetCheckBox.Enabled = false; // guideline appearance this.dashPatternLineNumericUpDown.Value = (decimal)(rulerItem.GuidelineDashPattern[0]); this.dashPatternSpaceNumericUpDown.Value = (decimal)(rulerItem.GuidelineDashPattern[1]); this.guidelineThicknessNumericUpDown.Value = (decimal)(rulerItem.GuidelineThickness); this.guidelineColorPictureBox.BackColor = rulerItem.GuidelineColor; // measure and unit this.displayUnitCheckBox.Checked = rulerItem.DisplayUnit; this.displayMeasureTextCheckBox.Checked = rulerItem.DisplayDistance; this.unitComboBox.SelectedIndex = (int)(rulerItem.CurrentUnit); this.fontColorPictureBox.BackColor = rulerItem.MeasureColor; updateChosenFont(rulerItem.MeasureFont); }
public EditRuler(LayerRuler layer, LayerRuler.RulerItem rulerItem, LayerRuler.RulerItem rulerItemTemplateForNewProperties) { mRulerLayer = layer; // memorise the item mRulerItem = rulerItem; // and clone the two templates, for doing undo/redo and keeping the properties when the ruler change mOldRulerItemTemplate = rulerItem.Clone() as LayerRuler.RulerItem; mNewRulerItemTemplate = rulerItemTemplateForNewProperties.Clone() as LayerRuler.RulerItem; }