예제 #1
0
        private void namedStyleButton_Click(object sender, EventArgs e)
        {
            using (NamedStyleSettingForm f =
                       new NamedStyleSettingForm())
            {
                CustomNamedHatchStyles   cnhs;
                CustomNamedTextureStyles cnts;
                if (Surface.Source.NamedHatchStyle.IsEmpty)
                {
                    cnhs = new CustomNamedHatchStyles();
                }
                else
                {
                    cnhs = Surface.Source.NamedHatchStyle as CustomNamedHatchStyles;
                }
                if (Surface.Source.NamedTextureStyle.IsEmpty)
                {
                    cnts = new CustomNamedTextureStyles();
                }
                else
                {
                    cnts = Surface.Source.NamedTextureStyle as CustomNamedTextureStyles;
                }

                f.SetNamedStyle(cnhs, cnts);
                f.ShowDialog();

                if (f.NamedHatchStyle.GetNames().Length == 0)
                {
                    cnhs = null;
                }
                else
                {
                    cnhs = f.NamedHatchStyle;
                }
                if (f.NamedTextureStyle.GetNames().Length == 0)
                {
                    cnts = null;
                }
                else
                {
                    cnts = f.NamedTextureStyle;
                }

                Surface.Source.Load(Surface.Source.Background,
                                    Surface.Source.Size, cnhs, cnts,
                                    Surface.Source.Shapes);
            }
        }
예제 #2
0
 public void SetNamedStyle(CustomNamedHatchStyles hatchStyle,
                           CustomNamedTextureStyles textureStyle)
 {
     _cnhs = hatchStyle;
     _cnts = textureStyle;
     lstNamedHatch.Items.Clear();
     txtName.Clear();
     if (_cnhs != null)
     {
         foreach (string s in _cnhs.GetNames())
         {
             lstNamedHatch.Items.Add(s);
         }
     }
     if (_cnts != null)
     {
         foreach (string s in _cnts.GetNames())
         {
             lstNamedHatch.Items.Add(s);
         }
     }
 }