public void AddRowTest() { var percentWidths = new[] { 20, 30, 50 }; var controls = new[] { new InputBox(new XRect(0, 0, 10, 20), ""), new InputBox(new XRect(0, 0, 10, 30), ""), new InputBox(new XRect(0, 0, 10, 50), ""), }; var rect = new XRect(0, 0, 100 + DefaultValues.Groupbox.MarginLeft + DefaultValues.Groupbox.MarginRight, 10); var target = new GroupBox(rect); target.AddRow(controls, percentWidths); foreach (var control in controls.Zip(target.Controls, (i, o) => new { Input = i, Output = o })) { Assert.AreSame(control.Input, control.Output); } Assert.AreEqual(target.Controls.ElementAt(0).Rect.Left, 0); Assert.AreEqual(target.Controls.ElementAt(1).Rect.Left, 20); Assert.AreEqual(target.Controls.ElementAt(2).Rect.Left, 50); Assert.AreEqual(target.Controls.ElementAt(0).Rect.Width, 20); Assert.AreEqual(target.Controls.ElementAt(1).Rect.Width, 30); Assert.AreEqual(target.Controls.ElementAt(2).Rect.Width, 50); Assert.AreEqual(target.Rect.Height, target.MarginBottom + target.MarginTop + 50); }
public void AppendHeader(TNaglowek naglowek, string nip) { var headerBigFont = new XFont(DefaultValues.Groupbox.Font.FontFamily.Name, 12, XFontStyle.Bold, DefaultValues.Groupbox.Font.PdfOptions); var nipContent = new GroupBox(0, _document.Width * 3 / 4, "") { MarginLeft = 0, MarginTop = 0, MarginRight = 0, MarginBottom = 0 }; var percentRowWidths = new[] { 45, 35, 20 }; var rowControls = new[] { new InputBox(Resources.InputTitle1, nip), new InputBox(Resources.InputTitle2) {Brush = XBrushes.LightGray}, new InputBox(Resources.InputTitle3) {Brush = XBrushes.LightGray}, }; nipContent.AddRow(rowControls, percentRowWidths); _document.AddContainer(nipContent); var miesiacVal = naglowek.DateType == ItemChoiceType.Miesiac ? naglowek.Miesiac.ToString() : ""; var kwartalVal = naglowek.ItemElementName == ItemChoiceType.Kwartal ? naglowek.Kwartal.ToString() : ""; var titleContent = new GroupBox(0, _document.Width, "") { MarginBottom = 10, Brush = new XSolidBrush(XColor.FromArgb(128, 128, 255)), Controls = new List<IControl> { new Label(20, 0, Resources.TitleLabel1) {Font = headerBigFont}, new Label(150, 0, Resources.TitleLabel2) {Font = headerBigFont}, new Label(270, 50, Resources.TitleLabel3) {Font = headerBigFont}, new InputBox(new XRect(200, 40, 60, 30), Resources.InputTitle4, miesiacVal), new InputBox(new XRect(300, 40, 60, 30), Resources.InputTitle5, kwartalVal), new InputBox(new XRect(400, 40, 80, 30), Resources.InputTitle6, naglowek.Rok) } }; _document.AddContainer(titleContent); var infoFont = new XFont(DocumentContainer.FontFamily, 8); var infoContent = new GroupBox(0, _document.Width, "") { MarginLeft = 5, MarginTop = 1, MarginRight = 1, MarginBottom = 1, Controls = new List<IControl> { new Label(0, 0, Resources.InfoContent0Label) {Font = infoFont}, new Label(0, 10, Resources.InfoContent1Label) {Font = infoFont}, new Label(0, 40, Resources.InfoContent2Label) {Font = infoFont}, new Label(0, 50, Resources.InfoContent3Label) {Font = infoFont}, new Label(new XRect(80, 0, _document.Width, 50), Resources.InfoContent0Label){Font = infoFont}, new Label(new XRect(80, 10, _document.Width, 50), Resources.InfoContent1Value){Font = infoFont}, new Label(new XRect(80, 40, _document.Width, 50), Resources.InfoContent2Value){Font = infoFont}, new Label(new XRect(80, 50, _document.Width, 70), Resources.InfoContent3Value){Font = infoFont}, } }; _document.AddContainer(infoContent); }
public void AppendFContent() { var fContent = new GroupBox(0, _document.Width, Resources.ContainerTitleF); var percentRow1Widths = new[] { 40, 60 }; var row1Controls = new[] { new InputBox(Resources.InputTitle20), new InputBox(Resources.InputTitle21), }; var percentRow2Widths = new[] { 25, 25, 50 }; var row2Controls = new[] { new InputBox(Resources.InputTitle22), new InputBox(Resources.InputTitle23), new InputBox(Resources.InputTitle24) }; fContent.AddRow(row1Controls, percentRow1Widths); fContent.AddRow(row2Controls, percentRow2Widths); _document.AddContainer(fContent); }
private void AppendB2Content(GroupBox b2Content, TAdresZagraniczny adres) { var percentRow1Widths = new[] { 20, 45, 35 }; var row1Controls = new[] { new InputBox(Resources.InputTitle10, KodKrajowyDictionary.GetCode(adres.KodKraju)), new InputBox(Resources.InputTitle11), new InputBox(Resources.InputTitle12), }; var percentRow2Widths = new[] { 25, 45, 15, 15 }; var row2Controls = new[] { new InputBox(Resources.InputTitle13), new InputBox(Resources.InputTitle14, adres.Ulica), new InputBox(Resources.InputTitle15, adres.NrDomu), new InputBox(Resources.InputTitle16, adres.NrLokalu) }; var percentRow3Widths = new[] { 40, 20, 40 }; var row3Controls = new[] { new InputBox(Resources.InputTitle17, adres.Miejscowosc), new InputBox(Resources.InputTitle18, adres.KodPocztowy), new InputBox(Resources.InputTitle19) }; b2Content.AddRow(row1Controls, percentRow1Widths); b2Content.AddRow(row2Controls, percentRow2Widths); b2Content.AddRow(row3Controls, percentRow3Widths); }
private void AppendB1Content(GroupBox b1Content, TIdentyfikatorOsobyFizycznej osobyFizycznej) { var container = new GroupBox() { MarginTop = 0, MarginBottom = 0, MarginLeft = 0, MarginRight = 0, Brush = XBrushes.White }; var personDataWidths = new[] { 25, 25, 25, 25 }; var personDataControls = new[] { new InputBox(Resources.InputTitle9, osobyFizycznej.Nazwisko){Pen = XPens.Transparent}, new InputBox(Resources.InputTitle9A, osobyFizycznej.ImiePierwsze){Pen = XPens.Transparent}, new InputBox(Resources.InputTitle9B, osobyFizycznej.DataUrodzenia.ToString("dd-MM-yyyy")){Pen = XPens.Transparent}, new InputBox(Resources.InputTitle9C, osobyFizycznej.PESEL){Pen = XPens.Transparent}, }; container.AddRow(personDataControls, personDataWidths); b1Content.AddRow(container); }
private void AppendB1Content(GroupBox b1Content, TIdentyfikatorOsobyNiefizycznej osobyNiefizycznej) { var container = new GroupBox() { MarginTop = 0, MarginBottom = 0, MarginLeft = 0, MarginRight = 0, Brush = XBrushes.White }; var companyDataWidths = new[] { 75, 25 }; var companyDataControls = new[] { new InputBox(Resources.InputTitle9D, osobyNiefizycznej.PelnaNazwa){Pen = XPens.Transparent}, new InputBox(Resources.InputTitle9E, osobyNiefizycznej.REGON){Pen = XPens.Transparent}, }; container.AddRow(companyDataControls, companyDataWidths); b1Content.AddRow(container); }
public void AddRow(ICollection<IControl> controls, int marginTop = 0, int marginBottom = 0) { if (controls.Count != ColumnCount) { throw new ArgumentException("Column count and controls count have to be equal"); } GroupBox row = GetNewRow(_left + MarginLeft); ////Each Control box into groupbox with no margins, draw cell border var cells = new List<IControl>(); foreach (IControl control in controls) { var groupBox = new GroupBox { MarginLeft = 0, MarginRight = 0, MarginTop = marginTop, MarginBottom = marginBottom, }; groupBox.AddRow(control); cells.Add(groupBox); } row.AddRow(cells, _columnWidths); Rows.Add(row); _currentY += row.Rect.Height; Rect = new XRect(Rect.X, Rect.Y, Rect.Width, _currentY + MarginTop + MarginBottom); }
public void AddRowTest2() { var rect = new XRect(0, 0, 100, 20); var target = new GroupBox(rect); ICollection<IControl> controls = new Collection<IControl> { new Label(0, 0, "foo"), new Label(0, 0, "bar") }; ICollection<int> percentWidths = new Collection<int>() { 50, 50 }; target.AddRow(controls, percentWidths); Assert.AreEqual(target.Controls.Count, 2); }
public void AddRowTest1() { var rect = new XRect(0, 0, 50, 50); var target = new GroupBox(rect); IControl control = new InputBox("foo", "bar"); target.AddRow(control); Assert.AreEqual(target.Controls.Contains(control), true); }