Example #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            switch (flag)
            {
                case 1:
                    pDetail.Controls.Clear();
                    UCPrinter ucPrinter = new UCPrinter();
                    ucPrinter.Dock = DockStyle.Fill;

                    ucPrinter.btnRemove.Hide();

                    ucPrinter.btnSave.Click += btnSaveInforPrinter_Click;

                    ucPrinter.ResetPrinterList = new ResetPrinterList(this.ResetPriter);

                    pDetail.Controls.Add(ucPrinter);

                    break;
                case 2:
                    pDetail.Controls.Clear();
                    UCPrinterJobDetail ucJob = new UCPrinterJobDetail();
                    ucJob.Dock = DockStyle.Fill;
                    pDetail.Controls.Add(ucJob);
                    ucJob.LoadPriterMapp();

                    ucJob.btnSave.Click += btnSaveInforPrinterJob_Click;

                    ucJob.btnRemove.Hide();

                    break;
            }
        }
Example #2
0
        void ucPList_Click(object sender, EventArgs e)
        {
            UCPrinterList ucPList = (UCPrinterList)sender;
            PrinterModel item = (PrinterModel)ucPList.Tag;
            foreach (Control ctr in flpPrintList.Controls)
            {
                if (ctr.BackColor == Color.FromArgb(0, 153, 51))
                {
                    ctr.BackColor = Color.FromArgb(255, 255, 255);
                    ctr.ForeColor = Color.FromArgb(51, 51, 51);
                }
            }
            ucPList.BackColor = Color.FromArgb(0, 153, 51);
            ucPList.ForeColor = Color.FromArgb(255, 255, 255);
            if (pDetail.Controls.Count > 0)
            {
                if (pDetail.Controls[0] is UCPrinter)
                {

                    UCPrinter uc = (UCPrinter)pDetail.Controls[0];
                    uc.btnRemove.Show();
                    uc.lblTitle.Text = item.PrintName;
                    uc.txtPrintName.Text = item.PrintName;
                    uc.cbPrintType.SelectedIndex = item.PrinterType;
                    uc.cbSharePrint.SelectedItem = item.PrinterName;
                    uc.btnRemove.Click += btnRemove_Click;
                    uc.btnRemove.Tag = item;

                    uc.btnSave.Click += btnSaveInforPrinter_Click;
                    uc.btnSave.Tag = item;

                }
            }
            else
            {
                UCPrinter ucPrinter = new UCPrinter();

                ucPrinter.Width = pDetail.Width;
                ucPrinter.Dock = DockStyle.Fill;
                pDetail.Controls.Add(ucPrinter);
                ucPrinter.lblTitle.Text = item.PrintName;
                ucPrinter.txtPrintName.Text = item.PrintName;
                ucPrinter.cbPrintType.SelectedIndex = item.PrinterType;
                ucPrinter.cbSharePrint.SelectedItem = item.PrinterName;
                ucPrinter.btnRemove.Click += btnRemove_Click;
                ucPrinter.btnRemove.Tag = item;

                ucPrinter.btnSave.Click += btnSaveInforPrinter_Click;
                ucPrinter.btnSave.Tag = item;
            }
        }