public Rec(Rec R) { _Rec.X = R.Xn; _Rec.Y = R.Yn; _Rec.Width = R.Width; _Rec.Height = R.Height; BorderCol = R.BorderCol; Col = R.Col; ZOrder = R.ZOrder; BorderWidth = R.BorderWidth; TypeShape = Nows.Rec; Name = R.Name; // G = R.G; DoXY(); }
private void WriteRToFile(BinaryWriter dataOut, Rec R) { dataOut.Write((int)R.TypeShape); dataOut.Write(R.BorderCol.ToArgb()); dataOut.Write(R.Col.ToArgb()); dataOut.Write(R.ZOrder); dataOut.Write(R.BorderWidth); dataOut.Write(R.Xn); dataOut.Write(R.Yn); dataOut.Write(R.Width); dataOut.Write(R.Height); }
private void pOut_MouseUp(object sender, MouseEventArgs e) { if (down) { down = false; Graphics g = Graphics.FromHwnd(tcTabs.TabPages[tcTabs.SelectedIndex].Handle); switch (Now) { case Nows.None: if (CurrentPage.Selected.Count != 0) CurrentPage.Selected.ReSelect(); else { g.DrawRectangle(new Pen(tcTabs.TabPages[tcTabs.SelectedIndex].BackColor), PnOut.X, PnOut.Y, Math.Abs(e.X - Pn.X), Math.Abs(e.Y - Pn.Y)); CurrentPage.Selected.Clear(); for (int i = 0; i < CurrentPage.Items.Count; i++) { Item It = (Item)CurrentPage.Items[i]; if (It.X1 >= PnOut.X + Dlg && It.X2 <= Math.Max(e.X, Pn.X) && It.Y1 >= PnOut.Y + Dlv && It.Y2 <= Math.Max(e.Y, Pn.Y)) CurrentPage.Selected.Add(CurrentPage.Items[i]); } if (CurrentPage.Selected.Count == 1) tscbAlls.SelectedIndex = CurrentPage.Selected.ZOrder; else tscbAlls.SelectedIndex = -1; if (CurrentPage.Selected.Count == 1) { Item It = (Item)CurrentPage.Selected[0]; if (It.TypeShape == Nows.Pie) { PieButtons(true); Pie P = (Pie)CurrentPage.Selected[0]; tstbAlfa.Text = P.startAngle.ToString(); tstbBeta.Text = P.sweepAngle.ToString(); } } } break; case Nows.Line: { if (Pn.X != e.X && Pn.Y != e.Y) { Line L = new Line(Pn.X + Dlg, Pn.Y + Dlv, e.X + Dlg, e.Y + Dlv, BorderCol, ItCol, CurrentPage.ZOrdCurrent++, LinesWidth, string.Format("Линия {0}", CurrentPage.LC++)); CurrentPage.Items.Add(L); CurrentPage.Selected.Clear(); CurrentPage.Selected.Add(L); // CurrentPage.Selected.ZOrder = L.ZOrder; L.RePain(Dlg, Dlv, 1, g); tscbAlls.Items.Add(L.Name); tscbAlls.SelectedIndex = tscbAlls.Items.Count - 1; } break; } case Nows.Rec: { if (Pn.X != e.X && Pn.Y != e.Y) { Rec R = new Rec(PnOut.X + Dlg, PnOut.Y + Dlv, Math.Abs(e.X - Pn.X), Math.Abs(e.Y - Pn.Y), BorderCol, ItCol, CurrentPage.ZOrdCurrent++, LinesWidth, string.Format("Прямоугольник {0}", CurrentPage.RC++)); CurrentPage.Items.Add(R); CurrentPage.Selected.Clear(); CurrentPage.Selected.Add(R); // CurrentPage.Selected.ZOrder = R.ZOrder; R.RePain(Dlg, Dlv, true, 1, g); tscbAlls.Items.Add(R.Name); tscbAlls.SelectedIndex = tscbAlls.Items.Count - 1; } break; } case Nows.Ellip: { if (Pn.X != e.X && Pn.Y != e.Y) { Pie E = new Pie(PnOut.X + Dlg, PnOut.Y + Dlv, Math.Abs(e.X - Pn.X), Math.Abs(e.Y - Pn.Y), BorderCol, ItCol, CurrentPage.ZOrdCurrent++, LinesWidth, Nows.Ellip, 0.0f, 360.0f, string.Format("Другая фигура {0}", CurrentPage.PC++)); CurrentPage.Items.Add(E); CurrentPage.Selected.Clear(); CurrentPage.Selected.Add(E); // CurrentPage.Selected.ZOrder = E.ZOrder; E.RePain(Dlg, Dlv, true, 1, g); tscbAlls.Items.Add(E.Name); tscbAlls.SelectedIndex = tscbAlls.Items.Count - 1; } break; } case Nows.Pie: { if (Pn.X != e.X && Pn.Y != e.Y) { Pie E = new Pie(PnOut.X + Dlg, PnOut.Y + Dlv, Math.Abs(e.X - Pn.X), Math.Abs(e.Y - Pn.Y), BorderCol, ItCol, CurrentPage.ZOrdCurrent++, LinesWidth, Nows.Pie, startAng, sweepAng, string.Format("Другая фигура {0}", CurrentPage.PC++)); CurrentPage.Items.Add(E); CurrentPage.Selected.Clear(); CurrentPage.Selected.Add(E); E.RePain(Dlg, Dlv, true, 1, g); tscbAlls.Items.Add(E.Name); tscbAlls.SelectedIndex = tscbAlls.Items.Count - 1; } break; } } RePainAllItems(true); WriteCounts(); } CheckEnables(); }
public void Add(Rec R) { _ItemsObj.Add(R); _RCount++; }