private void chooseEraser_Click(object sender, EventArgs e) { abstractFabric = new LineFabric(); Eraser = true; textBox3.Visible = false; Pipetka = false; fill = false; }
private void button5_Click(object sender, EventArgs e) { abstractFabric = new FigureFabric(); Figure = new Poligon(); textBox3.Visible = true; Eraser = false; Pipetka = false; fill = false; Fill = null; toolStripDropDownButton1.Image = безЗаливкиToolStripMenuItem.Image; }
private void button2_Click(object sender, EventArgs e) { Figure = null; abstractFabric = new UncommonPoligon(); textBox3.Visible = false; Eraser = false; Pipetka = false; fill = false; isFirstPoligon = true; Fill = null; toolStripDropDownButton1.Image = безЗаливкиToolStripMenuItem.Image; drower = abstractFabric.CreateDrower(Figure, brush, Fill); }
private void Form1_Load(object sender, EventArgs e) { isDrow = false; isFirst = false; isFirstPoligon = false; color = Color.Black; q.bitmap = new Bitmap(pictureBox1.Width, pictureBox1.Height); q.bitFigure = new Bitmap(pictureBox1.Width, pictureBox1.Height); q.CreateBitmapList(); brush = new Brush(pictureBox1.Width, pictureBox1.Height); pictureBox1.Image = q.bitmap; isCollapsed = false; abstractFabric = new LineFabric(); textBox3.Visible = false; q.heigth = pictureBox1.Height; q.width = pictureBox1.Width; }
private void CreateFabric() { Button tmpBtn = new Button(); try { Type type = null; using (var fs = new FileStream(path, FileMode.Open)) { var bytes = new byte[fs.Length]; fs.Read(bytes, 0, bytes.Length); Assembly assembly = AppDomain.CurrentDomain.Load(bytes); type = assembly.GetExportedTypes()[0]; } AbstractFabric fab = Activator.CreateInstance(type) as AbstractFabric; Creators.Add(fab); tmpBtn.Location = new Point(btnPosX, 0); tmpBtn.Size = new Size(BTNSIZE, BTNSIZE); try { tmpBtn.BackgroundImage = Image.FromFile(Environment.CurrentDirectory + "\\Images\\" + fab.GetImgName()); } catch { MessageBox.Show("Не удалось найти картинку для кнопки, кнопка будет пустая!"); } tmpBtn.BackgroundImageLayout = ImageLayout.Stretch; tmpBtn.Click += btn_Clicked; btnPosX += tmpBtn.Width + MARGIN; btnCount++; this.pnlBtnPannel.Invoke((MethodInvoker)(() => pnlBtnPannel.Controls.Add(tmpBtn))); Types.Add(fab.GetFType()); Buttons.Add(tmpBtn); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void GetBrush(Brush brush, AbstractFabric abstractFabric) { this.brush = brush; this.abstractFabric = abstractFabric; }