public void ColoneCoe(CollectionOfElements coe) { for (int i = 0; i < NumberOfElements; i++) { this.Elements[i].modElement = coe.Elements[i].modElement; this.Elements[i].modColor = coe.Elements[i].modColor; this.Elements[i].GetSepperation = coe.Elements[i].GetSepperation; } }
public CollectionToSort(CollectionOfElements coe, int SwapCost, int ComparisonCost) : base(coe.modNumberOfElements, coe.modBuffer, coe.GetPictureBox) { //SecondaryTab = new int[this.NumberOfElements]; SecondaryTab = new Element[this.NumberOfElements]; Stopwatch = new Stopwatch(); this.SwapCost = SwapCost; this.ComparisonCost = ComparisonCost; for (int i = 0; i < NumberOfElements; i++) { Elements[i] = new Element(coe.getElementValue(i), coe.modBuffer, coe.GetPictureBox, coe.getElementSepperation(i), coe.getElementWidth(i), coe.getElementColor(i)); //SecondaryTab[i] = coe.getElementValue(i); SecondaryTab[i] = new Element(coe.getElementValue(i), coe.modBuffer, coe.GetPictureBox, coe.getElementSepperation(i), coe.getElementWidth(i), coe.getElementColor(i)); } }
private void Draw(object sender, MouseEventArgs e) { try { NumberOfElements = Int32.Parse(txtbNumberOfElements.Text); test = new CollectionOfElements(NumberOfElements, Bitmap, pctbox_drawingArea); test2 = new CollectionOfElements(NumberOfElements, Bitmap2, pctbox_drawingArea2); } catch { MessageBox.Show("Please set parameters", "No parameters"); return; } if (pctbox_drawingArea.Image != null) { pctbox_drawingArea.Image.Dispose(); pctbox_drawingArea.Image = null; } if (pctbox_drawingArea2.Image != null) { pctbox_drawingArea2.Image.Dispose(); pctbox_drawingArea2.Image = null; } Bitmap = new Bitmap(pctbox_drawingArea.Width, pctbox_drawingArea.Height); Bitmap2 = new Bitmap(pctbox_drawingArea2.Width, pctbox_drawingArea2.Height); ChooseFillType(); test2.Initiate(); test2.ColoneCoe(test); test.DrawElements(); test2.DrawElements(); btnSort.Enabled = true; }