コード例 #1
0
ファイル: main.cs プロジェクト: EvgenyKarataev/GraphicEditor
 private GroupItem ReadGIFromFile(BinaryReader dataIn)
 {
     int Count = dataIn.ReadInt32();
     Nows TS;
     GroupItem GI = new GroupItem();
     for (int i = 0; i < Count; i++)
     {
         TS = (Nows)dataIn.ReadInt32();
         switch (TS)
         {
             case Nows.Line:
                 GI.Add(ReadLFromFile(dataIn));
                 break;
             case Nows.Rec:
                 GI.Add(ReadRFromFile(dataIn));
                 break;
             case Nows.Ellip:
             case Nows.Pie:
                 GI.Add(ReadPFromFile(dataIn, TS));
                 break;
             case Nows.Group:
                 GI.Add(ReadGIFromFile(dataIn));
                 break;
         }
     }
     GI.Name = string.Format("Группа {0}", CurrentPage.GC++);
     return GI;
 }
コード例 #2
0
ファイル: main.cs プロジェクト: EvgenyKarataev/GraphicEditor
        private void tsmiGroup_Click(object sender, EventArgs e)
        {
            if (CurrentPage.Selected.Count <= 1) return;
            GroupItem GI = new GroupItem();
            for (int i = CurrentPage.Selected.Count - 1; i >= 0; i--)
            {
                Item It = (Item)CurrentPage.Selected[i];
                switch (It.TypeShape)
                {
                    case Nows.Line:
                        Line L = (Line)CurrentPage.Selected[i];
                        GI.Add(new Line(L));
                        CurrentPage.Items.RemoveObj(L);
                        CurrentPage.ZOrdCurrent--;
                        break;
                    case Nows.Rec:
                        Rec R = (Rec)CurrentPage.Selected[i];
                        GI.Add(new Rec(R));
                        CurrentPage.Items.RemoveObj(R);
                        CurrentPage.ZOrdCurrent--;
                        break;
                    case Nows.Ellip:
                    case Nows.Pie:
                        Pie P = (Pie)CurrentPage.Selected[i];
                        GI.Add(new Pie(P));
                        CurrentPage.Items.RemoveObj(P);
                        CurrentPage.ZOrdCurrent--;
                        break;
                    case Nows.Group:
                        GroupItem Gr = (GroupItem)CurrentPage.Selected[i];
                        GI.Add(new GroupItem(Gr));
                        CurrentPage.Items.RemoveObj(Gr);
                        CurrentPage.ZOrdCurrent--;
                        break;
                }

            }
            GI.Name = string.Format("Группа {0}", CurrentPage.GC++);
            CurrentPage.Items.Add(GI);
            CurrentPage.ZOrdCurrent++;
            Sort();
            CurrentPage.Selected.Clear();
            CurrentPage.Selected.Add(GI);
            tscbAlls.SelectedIndex = GI.ZOrder;
            CheckEnables();
        }