Beispiel #1
0
        private void frmVatInvoice_Load(object sender, EventArgs e)
        {
            WindowState = FormWindowState.Maximized;
            dateTimePickerDareFm.Format       = DateTimePickerFormat.Custom;
            dateTimePickerDareFm.CustomFormat = "yyyy-MM-dd";
            dateTimePickerDareFm.Value        = DateTime.Now.AddDays(1 - DateTime.Now.Day); //月初
            dateTimePickerDateTo.Format       = DateTimePickerFormat.Custom;
            dateTimePickerDateTo.CustomFormat = "yyyy-MM-dd";
            dateTimePickerDateTo.Value        = DateTime.Now.AddMonths(1).AddDays(-DateTime.Now.Day); //月末


            DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
            DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();

            DataGridView_Invoice.AllowUserToAddRows              = false;
            DataGridView_Invoice.AllowUserToDeleteRows           = false;
            dataGridViewCellStyle1.BackColor                     = Color.LightCyan;
            DataGridView_Invoice.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
            DataGridView_Invoice.BackgroundColor                 = System.Drawing.Color.White;
            DataGridView_Invoice.BorderStyle                     = BorderStyle.Fixed3D;
            DataGridView_Invoice.ColumnHeadersBorderStyle        = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
            dataGridViewCellStyle2.Alignment                     = DataGridViewContentAlignment.MiddleCenter;//211, 223, 240
            dataGridViewCellStyle2.BackColor                     = Color.FromArgb(((int)(((byte)(211)))), ((int)(((byte)(223)))), ((int)(((byte)(240)))));
            dataGridViewCellStyle2.Font                        = new Font("宋体", 9F, FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            dataGridViewCellStyle2.ForeColor                   = Color.Navy;
            dataGridViewCellStyle2.SelectionBackColor          = SystemColors.Highlight;
            dataGridViewCellStyle2.SelectionForeColor          = SystemColors.HighlightText;
            DataGridView_Invoice.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
            DataGridView_Invoice.ColumnHeadersHeightSizeMode   = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            DataGridView_Invoice.EnableHeadersVisualStyles     = false;
            DataGridView_Invoice.GridColor                     = SystemColors.GradientInactiveCaption;
            //DataGridView_Invoice.ReadOnly = true;
            DataGridView_Invoice.RowHeadersVisible  = false;
            DataGridView_Invoice.RowTemplate.Height = 23;
            //DataGridView_Invoice.RowTemplate.ReadOnly = true;
            DataGridView_Invoice.AutoGenerateColumns = false;
            //dataGridView_Invoice.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
            DataGridView_Invoice.Columns["TotalAmount"].DefaultCellStyle.Alignment    = DataGridViewContentAlignment.MiddleRight;
            DataGridView_Invoice.Columns["TotalTaxAmount"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            DataGridView_Invoice.Columns["TotalTax"].DefaultCellStyle.Alignment       = DataGridViewContentAlignment.MiddleRight;
            DataGridView_Invoice.Columns["TotalAmount"].DefaultCellStyle.Format       = "N2";
            DataGridView_Invoice.Columns["TotalTaxAmount"].DefaultCellStyle.Format    = "N2";
            DataGridView_Invoice.Columns["TotalTax"].DefaultCellStyle.Format          = "N2";
            DataGridView_Invoice.Columns["InvImage"].DefaultCellStyle.NullValue       = null;
            bInitFlag = opskyScan.InitOpSkyScan(out msg); //初始化扫描仪
            if (!bInitFlag)
            {
                MessageBox.Show(msg, "提示");
                tsVatInvoiceScan.Enabled = false;
            }
            //绑定自定义控件
            panelMycontrol.Controls.Clear();
            PageControl pageControl = new PageControl();

            //pageControl.PageSize = (panelData.Height - 50) / 23;
            pageControl.Parent         = panelMycontrol;
            pageControl.Dock           = DockStyle.Left;
            pageControl.Kind           = 0;
            pageControl.PageIndex      = 0;
            pageControl.BindPageEvent += BindPage;
            pageControl.SetPage();
        }