示例#1
0
        public void drawSectionStructure()
        {
            //Panel formPanel = new Panel();
            formPanel      = new Panel();
            formPanel.Dock = DockStyle.Fill;
            this.Controls.Add(formPanel);
            formPanel.AutoScroll = true;

            int posX = 10;
            int posY = 10;

            //List<Section> orderedSectionList = sectionsList.OrderBy(x => x.processingOrder).ToList();
            for (int i = 0; i < sectionsList.Count; i++)
            //foreach (Section sec in orderedSectionList)
            {
                Section         sec          = sectionsList[i];
                SectionGroupBox sectionGroup = new SectionGroupBox(ref sec);
                sectionGroup.Width     = CentimeterToPixel((double)sec.SectionWidth / 1000) + 170;
                sectionGroup.Height    = CentimeterToPixel((double)(sec.SectionHeight + 423) / 1000);
                sectionGroup.Location  = new Point(posX, posY);
                sectionGroup.BackColor = Color.LightGray;
                sectionGroup.Text      = sec.SectionType;
                formPanel.Controls.Add(sectionGroup);

                Panel sectionViewGroup = new Panel();
                sectionViewGroup.Width     = CentimeterToPixel((double)sec.SectionWidth / 1000);
                sectionViewGroup.Height    = CentimeterToPixel((double)(sec.SectionHeight) / 1000);
                sectionViewGroup.Location  = new Point(0, CentimeterToPixel(0.423));
                sectionViewGroup.BackColor = Color.White;
                sectionGroup.Controls.Add(sectionViewGroup);

                List <SectionControl> controlsOnSec = sectionControls.FindAll(x => x.parentSectionId == sec.sectionId);
                if (!(controlsOnSec == null))
                {
                    foreach (SectionControl secCtrl in controlsOnSec)
                    {
                        Label sectionControlLabel = new Label();
                        sectionControlLabel.Size = new Size(CentimeterToPixel((double)secCtrl.controlWidth / 1000),
                                                            CentimeterToPixel((double)secCtrl.controlHeight / 1000));
                        sectionControlLabel.Location = new Point(CentimeterToPixel((double)secCtrl.controlXstart / 1000),
                                                                 CentimeterToPixel((double)secCtrl.controlYstart / 1000));

                        sectionControlLabel.BackColor = Color.LightBlue;
                        sectionControlLabel.Text      = secCtrl.sourceExpr;
                        //font of control
                        FontStyle fStyle;
                        if (secCtrl.fontBold)
                        {
                            fStyle = FontStyle.Bold;
                        }
                        else
                        {
                            fStyle = FontStyle.Regular;
                        }
                        sectionControlLabel.Font        = new System.Drawing.Font(sectionControlLabel.Font.FontFamily, 7, fStyle);
                        sectionControlLabel.BorderStyle = BorderStyle.FixedSingle;

                        sectionViewGroup.Controls.Add(sectionControlLabel);
                    }
                }

                TableLayoutPanel tlp1 = new TableLayoutPanel();
                //tlp1.Dock = DockStyle.Fill;
                tlp1.RowCount    = 1;
                tlp1.ColumnCount = 2;
                //tlp1.ColumnStyles = 50;
                tlp1.Location        = new Point(CentimeterToPixel((double)sec.SectionWidth / 1000), 0);
                tlp1.AutoSize        = true;
                tlp1.CellBorderStyle = TableLayoutPanelCellBorderStyle.OutsetDouble;

                CheckBox headerCheckBox = new CheckBox();
                headerCheckBox.AutoSize  = true;
                headerCheckBox.Text      = "Header";
                headerCheckBox.BackColor = Color.LightSlateGray;
                headerCheckBox.Checked   = sec.isOnRDLCHeader;
                headerCheckBox.Click    += new System.EventHandler(buttonHeader_Click);

                CheckBox footerCheckBox = new CheckBox();
                footerCheckBox.AutoSize  = true;
                footerCheckBox.Text      = "Footer";
                footerCheckBox.BackColor = Color.LightSlateGray;
                footerCheckBox.Checked   = sec.isOnRDLCFooter;
                footerCheckBox.Click    += new System.EventHandler(buttonFooter_Click);

                tlp1.Controls.Add(headerCheckBox, 0, 0);
                tlp1.Controls.Add(footerCheckBox, 1, 0);
                sectionGroup.Controls.Add(tlp1);

                posY += CentimeterToPixel((double)(sec.SectionHeight + 423) / 1000);
            }
        }
示例#2
0
 public SectionGroupBox(ref Section sectoAssgn)
 {
     sec = sectoAssgn;
 }