Beispiel #1
0
        private void Reload(string data)
        {
            var clientsplit = data.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);

            foreach (var clientx in clientsplit)
            {
                var datas = clientx.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                var key   = int.Parse(datas[0]);

                if (dsHinh.ContainsKey(key))
                {
                    dsHinh[key].Clear();
                }
                else
                {
                    dsHinh.Add(key, new List <BasicDraw>());
                }
                for (int i = 1; i < datas.Length; i++)
                {
                    string[] hinhsplit = datas[i].Split(new string[] { ".-." }, StringSplitOptions.RemoveEmptyEntries);

                    var       loaihinh = (Form1.DrawMode) int.Parse(hinhsplit[0]);
                    BasicDraw bd       = null;
                    switch (loaihinh)
                    {
                    case Form1.DrawMode.line:
                        bd = new LineDraw();
                        break;

                    case Form1.DrawMode.rectangle:
                        bd = new RectangleDraw();
                        break;

                    case Form1.DrawMode.eplise:
                        bd = new ElipseDraw();
                        break;

                    case Form1.DrawMode.circle:
                        bd = new CircleDraw();
                        break;

                    case Form1.DrawMode.polygon:
                        bd = new PolygonDraw();
                        break;
                    }
                    bd.Invalidate = () => Invalidate();
                    bd.Restore(datas[i]);
                    dsHinh[key].Add(bd);
                }
            }
            if (isSV)
            {
                Updates();
            }

            Invalidate();
        }
Beispiel #2
0
        private void AddPolygon()
        {
            if (PolygonTemp.Count == 0)
            {
                return;
            }
            else
            {
                PolygonDraw pd = new PolygonDraw(PolygonTemp, penCur);
                pd.Invalidate = () => Invalidate();
                var Shapes = dsHinh[0];

                Shapes.Add(pd);
                PolygonTemp.Clear();
                Invalidate();
                Updates();
            }
        }