public void Add(PrintPosItem obj) { if (FCount > (FItems.Length - 2)) { PrintPosItem[] nobjects = new PrintPosItem[FCount]; System.Array.Copy(FItems, 0, nobjects, 0, FCount); FItems = new PrintPosItem[FItems.Length * 2]; System.Array.Copy(nobjects, 0, FItems, 0, FCount); } FItems[FCount] = obj; FCount++; }
private void bdelete_Click(object sender, EventArgs e) { foreach (PrintItem nitem in subreportedit.SelectedItems.Values) { if (nitem is PrintPosItem) { PrintPosItem positem = (PrintPosItem)nitem; positem.Section.Components.Remove(positem); FReport.RemoveComponent(positem); } } subreportedit.ClearSelection(); foreach (BandInfo ninfo in subreportedit.SelectedItemsBands.Values) { subreportedit.ReDrawBand(ninfo); } AfterSelectDesign(this, null); subreportedit.parentcontrol.Invalidate(); }
public void SetObject(DesignerInterface obj) { CurrentList.Clear(); if (DataSource != null) { if (CurrentRow != null) { if (CurrentRow.DataBoundItem != null) { RowChange(this, new DataRowChangeEventArgs(((DataRowView)CurrentRow.DataBoundItem).Row, DataRowAction.Change)); } DataSource = null; } } CurrentInterface = obj; if (CurrentInterface == null) { Visible = false; return; } else { Visible = true; } Section nsection = null; bool issection = false; selectingobject = true; try { PrintPosItem nitem = null; if (CurrentInterface is DesignerInterfaceSection) { issection = true; nsection = (Section)CurrentInterface.SelectionList.Values[0]; } else if (CurrentInterface is DesignerInterfaceSizePos) { nitem = (PrintPosItem)CurrentInterface.SelectionList.Values[0]; nsection = nitem.Section; if (CurrentInterface.SelectionList.Count != 1) { nitem = null; } } ComboSelection.Items.Clear(); ComboSelection.SelectedIndex = -1; int selindex = 1; int newindex = 0; if (nsection != null) { ComboSelection.Items.Add(nsection.Name); CurrentList.Add(0, nsection); foreach (PrintPosItem xitem in nsection.Components) { ComboSelection.Items.Add(xitem.Name); CurrentList.Add(selindex, xitem); if (nitem == xitem) { newindex = selindex; } selindex++; } if (issection) { ComboSelection.SelectedIndex = 0; } else if (CurrentInterface.SelectionList.Count == 1) { ComboSelection.SelectedIndex = newindex; } if (Structure != null) { Structure.SelectItem(nsection, true); } } else { if (CurrentInterface.SelectionList.Count == 1) { ComboSelection.Items.Add(CurrentInterface.SelectionList.Values[0].Name); ComboSelection.SelectedIndex = 0; CurrentList.Add(0, CurrentInterface.SelectionList.Values[0]); if (Structure != null) { Structure.SelectItem(CurrentInterface.SelectionList.Values[0], true); } } } DataTable properties = FindDataTable(obj.SelectionClassName, obj); DataSource = properties; } finally { selectingobject = false; } }
private void bverticalgap_Click(object sender, EventArgs e) { // int maxx = int.MinValue; int minx = int.MaxValue; PrintPosItem firstitem = null; PrintPosItem lastitem = null; int totalwidth = 0; int itemcount = 0; SortedList <int, PrintPosItem> sorteditems = new SortedList <int, PrintPosItem>(); foreach (PrintPosItem nitem in subreportedit.SelectedItems.Values) { if (nitem.PosY + nitem.Height > maxx) { maxx = nitem.PosY + nitem.Height; lastitem = nitem; } if (nitem.PosY < minx) { minx = nitem.PosY; firstitem = nitem; } totalwidth = totalwidth + nitem.Height; itemcount++; } if (firstitem == null) { return; } if (lastitem == null) { return; } if (firstitem == lastitem) { return; } foreach (PrintPosItem nitem in subreportedit.SelectedItems.Values) { if ((nitem != firstitem) && (nitem != lastitem)) { sorteditems.Add(nitem.PosY, nitem); } } // Calculate free distance int firstpos = firstitem.PosY + firstitem.Height; int lastpos = lastitem.PosY; int freespace = lastpos - firstpos; foreach (PrintPosItem nitem in sorteditems.Values) { freespace = freespace - nitem.Height; } int dif = freespace / (itemcount - 1); foreach (PrintPosItem nitem in sorteditems.Values) { nitem.PosY = firstpos + dif; firstpos = nitem.PosY + nitem.Height; } foreach (BandInfo binfo in subreportedit.SelectedItemsBands.Values) { subreportedit.ReDrawBand(binfo); } subreportedit.parentcontrol.Invalidate(); }