示例#1
0
 // Vybere posledni shape obsahujici souradnice x,y
 public void ClickOnShape(int x, int y, RichTextBox r)
 {
     sRec   = null;
     selEle = null;
     foreach (Ele obj in this.List)
     {
         obj.selected = false;
         obj.DeSelect();
         if (obj.Contains(x, y))
         {
             selEle = obj;                     // ulozi referenci nalezeneho objektu
             // break;
             // nedelej break - pro prekryvajici se objekty beru posledni pridany objekt
         }
     }
     if (selEle != null)
     {
         selEle.selected = true;
         selEle.Select();
         selEle.Select(r);
         // nyni vytvorim uchopovy objekt
         if (selEle is PointSet)
         {
             sRec = new SelPoly(selEle);                     //vytvori uchopovy obdelnik typu polygonovy vyber
         }
         else
         {
             sRec = new SelRect(selEle);                     //vytvori uchopovy obdelnik typu obdelnikovy vyber
         }
     }
 }
示例#2
0
        // Do Listu prida Elipsu
        public void AddElipse(int x, int y, int x1, int y1, Color penC, Color fillC, float penW, bool colorFilled, bool textureFilled, TextureBrush textura)
        {
            if (x1 - minDim <= x)
            {
                x1 = x + minDim;
            }
            if (y1 - minDim <= y)
            {
                y1 = y + minDim;
            }

            DeSelect();
            Ellipse r = new Ellipse(x, y, x1, y1);

            r.Pero_barva    = penC;
            r.Pero_šířka    = penW;
            r.FillColor     = fillC;
            r.ColorFilled   = colorFilled;
            r.TextureFilled = textureFilled;
            r.FillTexture   = textura;

            List.Add(r);

            StoreDo("I", r);

            sRec   = new SelRect(r);
            selEle = r;
            selEle.Select();
        }
示例#3
0
        // Do Listu prida Jednoduchy text
        public void AddSimpleTextBox(int x, int y, int x1, int y1, RichTextBox t, Color penC, Color fillC, float penW, bool filled, bool textureFilled, TextureBrush textura)
        {
            if (x1 - minDim <= x)
            {
                x1 = x + minDim;
            }
            if (y1 - minDim <= y)
            {
                y1 = y + minDim;
            }

            DeSelect();
            Stext r = new Stext(x, y, x1, y1);

            r.Text     = t.Text;
            r.CharFont = t.SelectionFont;              //t.Font;


            r.Pero_barva    = penC;
            r.Pero_šířka    = penW;
            r.FillColor     = fillC;
            r.ColorFilled   = filled;
            r.TextureFilled = textureFilled;
            r.FillTexture   = textura;

            List.Add(r);

            StoreDo("I", r);

            sRec   = new SelRect(r);
            selEle = r;
            selEle.Select();
        }
示例#4
0
        // Do Listu prida Polygon - vseobecny
        public void AddPoly(int x, int y, int x1, int y1, Color penC, Color fillC, float penW, bool filled, ArrayList aa, bool curv, bool closed, bool textureFilled, TextureBrush textura)
        {
            /*if (x1 - minDim <= x)
             *      x1 = x + minDim;
             * if (y1 - minDim <= y)
             *      y1 = y + minDim;*/

            DeSelect();
            PointSet r = new PointSet(x, y, x1, y1, aa);

            r.Closed        = closed;
            r.Pero_barva    = penC;
            r.Pero_šířka    = penW;
            r.FillColor     = fillC;
            r.ColorFilled   = filled;
            r.Zakřivení     = curv;
            r.TextureFilled = textureFilled;
            r.FillTexture   = textura;

            List.Add(r);
            StoreDo("I", r);             // uloz do undo/redo bufferu

            sRec   = new SelPoly(r);
            selEle = r;
            selEle.Select();
        }
示例#5
0
        // Seskupi oznacene objekty
        public void GroupSelected()
        {
            ArrayList tmpList = new ArrayList();

            foreach (Ele elem in List)
            {
                if (elem.selected)
                {
                    tmpList.Add(elem);
                }
            }

            if (selEle != null)
            {
                selEle = null;
                sRec   = null;
            }

            foreach (Ele tmpElem in tmpList)
            {
                List.Remove(tmpElem);
            }

            Group g = new Group(tmpList);

            List.Add(g);

            sRec   = new SelRect(g);
            selEle = g;
            selEle.Select();

            // kdyz seskupuji/rusim seskupeni musim resetovat UndoBuffer
            undoB = new UndoBuffer(20);
        }
示例#6
0
        // Do Listu prida Caru
        public void AddLine(int x, int y, int x1, int y1, Color penC, float penW)
        {
            DeSelect();
            Line r = new Line(x, y, x1, y1);

            r.Pero_barva = penC;
            r.Pero_šířka = penW;

            List.Add(r);
            StoreDo("I", r);
            sRec = new SelRect(r);

            selEle = r;
            selEle.Select();
        }
示例#7
0
        // Do Listu prida ImageBox - obrazek = zahradni prvek
        public void AddImageBox(int x, int y, int x1, int y1, string st, Color penC, float penW)
        {
            if (x1 - (minDim * 10) <= x)
            {
                x1 = x + (minDim * 10);
            }
            if (y1 - (minDim + 10) <= y)
            {
                y1 = y + (minDim * 10);
            }

            DeSelect();
            ImageBox r = new ImageBox(x, y, x1, y1);

            r.Pero_barva = penC;
            r.Pero_šířka = penW;

            List.Add(r);

            StoreDo("I", r);

            if (!(st == null))
            {
                try
                {
                    Bitmap loadTexture = new Bitmap(st);
                    r.Prvek = loadTexture;
                }
                catch { }
            }


            sRec   = new SelRect(r);
            selEle = r;
            selEle.Select();
        }