Exemplo n.º 1
0
        private void SetPrint_Form_Load(object sender, EventArgs e)
        {
            if (_configTable != null)
            {
                _tabTable = new Dictionary <TabItem, CSetup>();
                IDictionaryEnumerator dicEnum = _configTable.GetEnumerator();
                while (dicEnum.MoveNext())
                {
                    DictionaryEntry ent = dicEnum.Entry;

                    TabItem tab = new TabItem();
                    tab.Text   = (string)ent.Key;
                    tab.Click += new EventHandler(tab_Click);

                    SettingPair set  = (SettingPair)ent.Value;
                    CSetup      temp = new CSetup(set);

                    CSettings     csetting = (CSettings)temp.Settings;
                    PrintSettings psetting = csetting.PrintConfig;

                    TabControlPanel tabControlPanel = new TabControlPanel();

                    tab.AttachedControl = tabControlPanel;

                    tabControlPanel.Dock     = System.Windows.Forms.DockStyle.Fill;
                    tabControlPanel.Location = new System.Drawing.Point(0, 26);
                    tabControlPanel.Name     = (string)ent.Key;
                    tabControlPanel.Size     = new System.Drawing.Size(409, 440);
                    tabControlPanel.TabItem  = tab;

                    PrintSetupPanel prtSetPane = new PrintSetupPanel();

                    tabControlPanel.Controls.Add(prtSetPane);

                    tabCtrl.Controls.Add(tabControlPanel);

                    this.tabCtrl.Tabs.Add(tab);

                    _tabTable.Add(tab, temp);
                }

                if (this.tabCtrl.Tabs.Count > 0)
                {
                    _currentSetup = _tabTable[this.tabCtrl.SelectedTab];

                    _currentSetupPanel = (PrintSetupPanel)this.tabCtrl.SelectedPanel.Controls[0];

                    CSettings     csetting = (CSettings)_currentSetup.Settings;
                    PrintSettings settings = csetting.PrintConfig;

                    _currentSetupPanel.SetValues(settings);
                    InitializePrintFormComponent(settings);
                }
            }
        }
Exemplo n.º 2
0
        void tab_Click(object sender, EventArgs e)
        {
            _currentSetup      = _tabTable[(TabItem)sender];
            _currentSetupPanel = (PrintSetupPanel)this.tabCtrl.SelectedPanel.Controls[0];

            CSettings     csetting = (CSettings)_currentSetup.Settings;
            PrintSettings settings = csetting.PrintConfig;

            _currentSetupPanel.SetValues(settings);
            InitializePrintFormComponent(settings);
        }