Example #1
0
        private void fillStyleComboBox_SelectedValueChanged(object sender, EventArgs e)
        {
            switch (this.fillStyleComboBox.SelectedIndex)
            {
            case -1:
                return;

            case 0:
                Sssh.IsFillColor = false;
                Sssh.IsHatch     = false;
                return;

            case 1:
                Sssh.IsFillColor = true;
                Sssh.IsHatch     = false;
                return;

            default:
                Sssh.IsFillColor = true;
                Sssh.IsHatch     = true;
                NamedHatchStyles nhs = Surface.Source.NamedHatchStyle;
                Sssh.Hatch = nhs.GetHatchStyle(
                    this.fillStyleComboBox.SelectedItem as string) ?? default(HatchStyle);
                break;
            }
        }
Example #2
0
 internal static Brush GetBrush(string name,
                                Color foreColor, Color backColor,
                                NamedHatchStyles nhs, NamedTextureStyles nts)
 {
     if (nhs != null)
     {
         HatchStyle?hatch = nhs.GetHatchStyle(name);
         if (hatch.HasValue)
         {
             return(new HatchBrush(hatch.Value, foreColor, backColor));
         }
     }
     if (nts != null)
     {
         Picture pic = nts.GetTexture(name);
         if (pic != null)
         {
             Image img = pic.GetImage();
             if (img != null)
             {
                 return(new TextureBrush(img));
             }
         }
     }
     return(new SolidBrush(foreColor));
 }