/// <summary> /// Handles the Click event of the buttonOK control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void buttonOK_Click(object sender, EventArgs e) { try { switch (BrushType) { case GlyphBrushType.Solid: SolidBrush = new GorgonGlyphSolidBrush { Color = colorSolidBrush.SelectedColor }; break; case GlyphBrushType.Texture: GorgonTexture2D newTexture = panelTextureEditor.Texture.Graphics.Textures.CreateTexture(panelTextureEditor.Texture.Name, panelTextureEditor.Texture.Settings); newTexture.Copy(panelTextureEditor.Texture); TextureBrush = new GorgonGlyphTextureBrush(newTexture) { WrapMode = panelTextureEditor.WrapMode, TextureRegion = panelTextureEditor.TextureRegion }; panelTextureEditor.Texture = null; break; case GlyphBrushType.Hatched: PatternBrush = new GorgonGlyphHatchBrush { ForegroundColor = panelHatchEditor.HatchForegroundColor, BackgroundColor = panelHatchEditor.HatchBackgroundColor, HatchStyle = panelHatchEditor.HatchStyle }; break; case GlyphBrushType.LinearGradient: GradientBrush = new GorgonGlyphLinearGradientBrush { Angle = panelGradEditor.Angle, ScaleAngle = panelGradEditor.ScaleAngle, GammaCorrection = panelGradEditor.UseGammaCorrection }; IEnumerable <GorgonGlyphBrushInterpolator> interpolators = panelGradEditor.GetInterpolators(); GradientBrush.Interpolation.Clear(); foreach (GorgonGlyphBrushInterpolator interpolator in interpolators) { GradientBrush.Interpolation.Add(interpolator); } break; } } catch (Exception ex) { GorgonDialogs.ErrorBox(this, ex); DialogResult = DialogResult.None; } }