Example #1
0
        private TabPage crtTab(lBasePanel newPanel)
        {
            TabPage newTabPage = new TabPage();

            newPanel.initCtrls();
            newTabPage.Controls.Add(newPanel.m_panel);
            newTabPage.Text = newPanel.m_tblInfo.m_tblAlias;
            return(newTabPage);
        }
Example #2
0
        public static lBasePanel crtPanel(lBasePanel panel)
        {
            lDataPanel   dataPanel   = lDataPanel.crtDataPanel(panel.m_dataPanel);
            lSearchPanel searchPanel = lSearchPanel.crtSearchPanel(dataPanel, panel.m_searchPanel.m_searchCtrls);
            lBaseReport  report      = lBaseReport.crtReport(panel.m_report);
            lBasePanel   newPanel    = new lBasePanel()
            {
                m_dataPanel   = dataPanel,
                m_searchPanel = searchPanel,
                m_report      = report
            };

            newPanel.init();
            return(newPanel);
        }
Example #3
0
        public Form1()
        {
            //this.Font = lConfigMng.getFont();

            InitializeComponent();

            //init config & load config
            appConfig.s_config = lConfigMng.crtInstance();
            if (appConfig.s_config.m_dbSchema == null)
            {
#if use_sqlite
                appConfig.s_config.m_dbSchema = new lSQLiteDbSchema();
#else
                appConfig.s_config.m_dbSchema = new lSqlDbSchema();
#endif  //use_sqlite
                appConfig.s_config.m_panels = new List <lBasePanel> {
                    new lReceiptsPanel(),
                    new lInterPaymentPanel(),
                    new lExternalPaymentPanel(),
                    new lSalaryPanel(),
                    //new lAdvancePanel(),
                };
#if save_config
                appConfig.s_config.UpdateConfig();
#endif
            }

            //init content provider
#if use_sqlite
            appConfig.s_contentProvider = lSQLiteContentProvider.getInstance(this);
#else
            appConfig.s_contentProvider = lSqlContentProvider.getInstance(this);
#endif  //use_sqlite

            //menu
            var mn = crtMenu();

            //tab control
            m_tabCtrl = new TabControl();
            //Controls.Add(m_tabCtrl);
            //m_tabCtrl.Anchor = AnchorStyles.Top | AnchorStyles.Left |AnchorStyles.Right|AnchorStyles.Bottom;
            m_tabCtrl.Dock = DockStyle.Fill;

#if crtnew_panel
            List <lBasePanel> newPanels = new List <lBasePanel>();
            foreach (lBasePanel panel in m_panels)
            {
                lBasePanel newPanel = lBasePanel.crtPanel(panel);
                newPanels.Add(newPanel);
                TabPage newTab = crtTab(newPanel);
                m_tabCtrl.TabPages.Add(newTab);
            }
            m_panels = newPanels;
#else
            foreach (lBasePanel panel in m_panels)
            {
                panel.Restore();
                TabPage newTab = crtTab(panel);
                m_tabCtrl.TabPages.Add(newTab);
            }
#endif  //crtnew_panel

            m_tabCtrl.SelectedIndex = 0;

            Load += new System.EventHandler(Form1_Load);

#if tab_header_blue
            //set tab header blue
            m_tabCtrl.DrawMode  = TabDrawMode.OwnerDrawFixed;
            m_tabCtrl.DrawItem += tabControl1_DrawItem;
#endif

            //set font
            //this.Font = lConfigMng.getFont();
            m_tabCtrl.Font = lConfigMng.getFont();

            Label tmpLbl = new Label();
            //tmpLbl.BorderStyle = BorderStyle.FixedSingle;
            tmpLbl.Anchor    = AnchorStyles.Right;
            tmpLbl.Text      = "© 2017 BAN TRI KHÁCH CHÙA BA VÀNG";
            tmpLbl.AutoSize  = true;
            tmpLbl.BackColor = Color.Transparent;

            TableLayoutPanel tmpTbl = new TableLayoutPanel();
            tmpTbl.Dock     = DockStyle.Fill;
            tmpTbl.RowCount = 3;
            tmpTbl.RowStyles.Add(new RowStyle());
            tmpTbl.RowStyles.Add(new RowStyle(SizeType.Percent, 100));
            tmpTbl.RowStyles.Add(new RowStyle());

            if (mn != null)
            {
                tmpTbl.Controls.Add((MenuStrip)mn, 0, 0);
            }

            tmpTbl.Controls.Add(tmpLbl, 1, 0);
            tmpTbl.Controls.Add(m_tabCtrl, 0, 1);
            tmpTbl.SetColumnSpan(m_tabCtrl, 2);

#if use_bg_work
            sts         = new StatusStrip();
            sts.Dock    = DockStyle.Bottom;
            stsLbl      = new ToolStripStatusLabel();
            stsLbl.Dock = DockStyle.Left;
            prg         = new ToolStripProgressBar();
            prg.Dock    = DockStyle.Right;
            prg.Maximum = 100;
            prg.Visible = false;
            sts.Items.AddRange(new ToolStripItem[] { stsLbl, prg });

            tmpTbl.Controls.Add(sts, 0, 2);
            tmpTbl.SetColumnSpan(sts, 2);
#endif

            Controls.Add(tmpTbl);

#if use_bg_work
            //background work
            m_bgwork            = myWorker.getWorker();
            m_bgwork.BgProcess += bg_process;
            m_bgwork.FgProcess += fg_process;
#endif
        }