Exemplo n.º 1
0
        public void AddDataControls(DataBlockTemplateModel templateModel)
        {
            ResetArea();
            int width = this.pn_Area.Width / templateModel.ColumnNum;

            for (int i = 0; i < templateModel.ColumnNum; i++)
            {
                DataBlockModel newDataBlockModel = PrintDatas.dataBlockMList.Find(m => m.TemplateModelID == templateModel.ModelID &&
                                                                                  m.Index == i);
                DataBlockControl dc = new DataBlockControl(1, newDataBlockModel, true);
                dc.Dock = DockStyle.Left;
                dc.DataSelectedEvent += Dc_DataSelectedEvent;
                dc.DataKeyDownEvent  += Dc_DataKeyDownEvent;
                currentDBList.Add(dc);
                this.pn_Area.Controls.Add(dc);
                dc.BringToFront();
            }
            currentDBList[currentDBList.Count - 1].Dock = DockStyle.Fill;
            foreach (var dc in currentDBList)
            {
                dc.FontFamilyName = templateModel.FontFamilyName;
                dc.FontSize       = templateModel.FontSize;
                dc.Distance       = templateModel.Distance;
                dc.LineWidth      = templateModel.LineWidth;
            }
        }
Exemplo n.º 2
0
        public void AddDataControls(DataBlockTemplateModel templateModel)
        {
            CurrentTemplateModel = templateModel;
            RemoveAllDataBlockControls();
            PaddingLeft   = templateModel.PaddingLeft;
            PaddingTop    = templateModel.PaddingTop;
            PaddingRight  = templateModel.PaddingRight;
            PaddingBottom = templateModel.PaddingBottom;
            ColumnNum     = templateModel.ColumnNum;
            PageWidth     = templateModel.PageWidth;
            int width = this.pn_Area.Width / ColumnNum;

            for (int i = 0; i < ColumnNum; i++)
            {
                DataBlockModel newDataBlockModel = PrintDatas.dataBlockMList.Find(m => m.TemplateModelID == templateModel.ModelID &&
                                                                                  m.Index == i);
                if (newDataBlockModel == null)
                {
                    newDataBlockModel = DataBlockModel.CreateNewInstance();
                    PrintDatas.dataBlockMList.Add(newDataBlockModel);
                    newDataBlockModel.ColumnWidth     = (int)(width / Percentage);
                    newDataBlockModel.Index           = i;
                    newDataBlockModel.TemplateModelID = templateModel.ModelID;
                }
                DataBlockControl dc = new DataBlockControl(Percentage, newDataBlockModel, false);
                dc.Dock = DockStyle.Left;
                dc.DataSelectedEvent += Dc_DataSelectedEvent;
                dataControls.Add(dc);
                this.pn_Area.Controls.Add(dc);
                dc.BringToFront();
            }
            dataControls[dataControls.Count - 1].Dock = DockStyle.Fill;
            FontFamilyName = templateModel.FontFamilyName;
            FontSize       = templateModel.FontSize;
            Distance       = templateModel.Distance;
            LineWidth      = templateModel.LineWidth;
        }