private void UpdateSimplePatternControls(ISimplePattern pattern) { cmbPatternType.SelectedItem = "Simple"; cbColorSimple.Color = pattern.FillColor; sldOpacitySimple.Value = pattern.Opacity; sldOpacitySimple.MaximumColor = pattern.FillColor.ToOpaque(); }
/// <summary> /// Updates the pattern when the simple color opacity changes. /// </summary> private void sldOpacitySimple_ValueChanged(object sender, EventArgs e) { if (_ignoreChanges) { return; } ISimplePattern sp = ccPatterns.SelectedPattern as ISimplePattern; if (sp != null) { sp.Opacity = (float)sldOpacitySimple.Value; } cbColorSimple.Color = sldOpacitySimple.MaximumColor.ToTransparent((float)sldOpacitySimple.Value); UpdatePreview(); }
/// <summary> /// Updates the pattern when the simple fill color changes. /// </summary> private void cbColorSimple_ColorChanged(object sender, EventArgs e) { if (_ignoreChanges) { return; } ISimplePattern sp = ccPatterns.SelectedPattern as ISimplePattern; if (sp != null) { sp.FillColor = cbColorSimple.Color; } sldOpacitySimple.Value = cbColorSimple.Color.GetOpacity(); sldOpacitySimple.MaximumColor = cbColorSimple.Color.ToOpaque(); UpdatePreview(); }
/// <summary> /// Sets the fill color of the top-most pattern. /// If the pattern is not a simple pattern, a simple pattern will be forced. /// </summary> /// <param name="color">The Color structure</param> public void SetFillColor(Color color) { if (_patterns == null) { return; } if (_patterns.Count == 0) { return; } ISimplePattern sp = _patterns[_patterns.Count - 1] as ISimplePattern; if (sp == null) { sp = new SimplePattern(); _patterns[_patterns.Count - 1] = sp; } sp.FillColor = color; }
private void UpdatePatternControls() { _ignoreChanges = true; cmbScaleMode.SelectedItem = _symbolizer.ScaleMode.ToString(); chkSmoothing.Checked = _symbolizer.Smoothing; _disableUnitWarning = true; cmbUnits.SelectedItem = _symbolizer.Units.ToString(); _disableUnitWarning = false; ocOutline.Pattern = ccPatterns.SelectedPattern; ISimplePattern sp = ccPatterns.SelectedPattern as ISimplePattern; if (sp != null) { UpdateSimplePatternControls(sp); } IPicturePattern pp = ccPatterns.SelectedPattern as IPicturePattern; if (pp != null) { UpdatePicturePatternControls(pp); } IGradientPattern gp = ccPatterns.SelectedPattern as IGradientPattern; if (gp != null) { UpdateGradientPatternControls(gp); } IHatchPattern hp = ccPatterns.SelectedPattern as IHatchPattern; if (hp != null) { UpdateHatchPatternControls(hp); } _ignoreChanges = false; UpdatePreview(); }