Ejemplo n.º 1
0
 private void picture_MouseDown(object sender, MouseEventArgs e)
 {
     if (cmb_custom_figures.SelectedIndex >= 0)
     {
         int index = cmb_custom_figures.SelectedIndex;
         CustomFigure.DrawCustomFigure(index, graphics, e.Location);
         picture.Invalidate();
         picture.Image = bmap;
     }
     else
     {
         if (cb_figures.SelectedIndex >= 0)
         {
             isDrawing = true;
             start     = new Point(e.X, e.Y);
             figure    = maker.FactoryMethod(fatness, color, start, start);
             currentFabrics.Add(maker);
         }
     }
 }
Ejemplo n.º 2
0
        private void picture_MouseDown(object sender, MouseEventArgs e)
        {
            if (isEdit)
            {
            }
            else
            {
                if (cmb_custom_figures.SelectedIndex >= 0)
                {
                    int index = cmb_custom_figures.SelectedIndex;
                    figuresExs = new List <MainFigure>(CustomFigure.DrawCustomFigure(index, graphics, e.Location));
                    int i = 0;
                    foreach (var figure in figuresExs)
                    {
                        jsonList.Add(new InfoForJSON()
                        {
                            fatness = figure.fatness, color = figure.color, topLeft = figure.topLeft, bottomRight = figure.bottomRight, figureName = CustomFigure.fabrics[index][i].ToString()
                        });
                        i++;
                    }

                    picture.Invalidate();
                    picture.Image = bmap;
                }
                else
                {
                    if (cb_figures.SelectedIndex >= 0)
                    {
                        isDrawing = true;
                        start     = new Point(e.X, e.Y);
                        figure    = maker.FactoryMethod(fatness, color, start, start);
                        currentFabrics.Add(maker);
                    }
                }
            }
        }