示例#1
0
        public void AddRowTest()
        {
            int columnCount = 4;
            ICollection<int> columnPercentWidths = new Collection<int>() { 25, 25, 25, 25 };
            double left = 10;
            double width = 120;
            string title = "title";
            var target = new TableControl(columnCount, columnPercentWidths, left, width, title);

            ICollection<IControl> controls = new Collection<IControl>()
                {
                    new InputBox("foo", "bar"),
                    new InputBox("foo", "bar"),
                    new InputBox("foo", "bar"),
                    new InputBox("foo", "bar")
                };
            int marginTop = 2;
            int marginBottom = 2;
            target.AddRow(controls, marginTop, marginBottom);
            Assert.AreEqual(target.ColumnCount, columnCount);
            Assert.AreEqual(target.Rows.Count, 1);

        }
        public void AppendEContent(IEnumerable<Grupa3> grupa3)
        {
            var headFont = new XFont(DocumentContainer.FontFamily, 10, XFontStyle.Bold);
            var head2Font = new XFont(DocumentContainer.FontFamily, 9, XFontStyle.Regular);

            var tableHeadWidths = new[] { 10, 40, 35, 15 };
            var eContent = new TableControl(4, tableHeadWidths, 0, _document.Width,
                                         Resources.ContainerTitleE);
            var tableHeadControls = new[]
                {
                    new Label(XParagraphAlignment.Center, Resources.TableHeadCellA) {Font = headFont},
                    new Label(XParagraphAlignment.Center, Resources.TableHeadCellB) {Font = headFont},
                    new Label(XParagraphAlignment.Center, Resources.TableHeadCellC) {Font = headFont},
                    new Label(XParagraphAlignment.Center, Resources.TableHeadCellD) {Font = headFont},
                };

            var tableHead2Controls = new[]
                {
                    new Label(XParagraphAlignment.Center, Resources.TableHead2CellA) {Font = head2Font},
                    new Label(XParagraphAlignment.Center, Resources.TableHead2CellB) {Font = head2Font},
                    new Label(XParagraphAlignment.Center, Resources.TableHead2CellC) {Font = head2Font},
                    new Label(XParagraphAlignment.Center, Resources.TableHead2CellD) {Font = head2Font},
                };
            eContent.AddHeadRow(tableHeadControls, 5, 15);
            eContent.AddHeadRow(tableHead2Controls, 0, 0);

            foreach (Grupa3 grupa in grupa3)
            {
                var tableRowControls = new[]
                    {
                        new TableCell(grupa.P_Ua.ToString()),
                        new TableCell(grupa.P_Ub),
                        new TableCell(grupa.P_Uc.ToString()),
                        new TableCell()
                    };
                eContent.AddRow(tableRowControls);
            }

            _document.AddContainer(eContent);
        }
        public void AppendDContent(IEnumerable<Grupa2> grupa2)
        {
            var headFont = new XFont(DocumentContainer.FontFamily, 10, XFontStyle.Bold);
            var head2Font = new XFont(DocumentContainer.FontFamily, 9, XFontStyle.Regular);

            var tableHeadWidths = new[] { 10, 40, 35, 15 };
            var dContent = new TableControl(4, tableHeadWidths, 0, _document.Width,
                                         Resources.ContainerTitleD);
            var tableHeadControls = new[]
                {
                    new Label(XParagraphAlignment.Center, Resources.TableHeadCellA) {Font = headFont},
                    new Label(XParagraphAlignment.Center, Resources.TableHeadCellB) {Font = headFont},
                    new Label(XParagraphAlignment.Center, Resources.TableHeadCellC) {Font = headFont},
                    new Label(XParagraphAlignment.Center, Resources.TableHeadCellD) {Font = headFont},
                };

            var tableHead2Controls = new[]
                {
                    new Label(XParagraphAlignment.Center, Resources.TableHead2CellA) {Font = head2Font},
                    new Label(XParagraphAlignment.Center, Resources.TableHead2CellB) {Font = head2Font},
                    new Label(XParagraphAlignment.Center, Resources.TableHead2CellC) {Font = head2Font},
                    new Label(XParagraphAlignment.Center, Resources.TableHead2CellD) {Font = head2Font},
                };
            dContent.AddHeadRow(tableHeadControls, 5, 15);
            dContent.AddHeadRow(tableHead2Controls, 0, 0);

            foreach (Grupa2 grupa in grupa2)
            {
                var tableRowControls = new Collection<IControl>()
                    {
                        new TableCell(grupa.P_Na.ToString()),
                        new TableCell(grupa.P_Nb),
                        new TableCell(grupa.P_Nc.ToString()),
                        new GroupBox(0, 50, "")
                            {
                                MarginTop = 5, MarginBottom = 5, MarginLeft = 35, MarginRight = 1,
                                Controls = new[]{new CheckBox(0, 0){IsChecked = grupa.IsChecked}}, Brush = XBrushes.White,
                            },   
                    };
                dContent.AddRow(tableRowControls);
            }

            _document.AddContainer(dContent);
        }