Exemple #1
0
        /// <summary>
        /// 初始化
        /// </summary>
        internal void Init()
        {
            this._DgvEx = new DataGridViewEx();
            DgvEx.Hide();
            DgvEx.AllowUserToAddRows      = false;
            DgvEx.AllowUserToDeleteRows   = false;
            DgvEx.ColumnVisibleEnableSave = false;
            DgvEx.ColumnWidthSave         = false;
            DgvEx.SelectionMode           = DataGridViewSelectionMode.FullRowSelect;


            DgvEx.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            DgvEx.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.DisplayedCells;

            DgvEx.SelectionMode     = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
            DgvEx.BackgroundColor   = System.Drawing.SystemColors.Window;
            DgvEx.BorderStyle       = System.Windows.Forms.BorderStyle.Fixed3D;
            DgvEx.RowHeadersVisible = false;
            DgvEx.EditMode          = DataGridViewEditMode.EditProgrammatically;
            //行字体颜色
            System.Windows.Forms.DataGridViewCellStyle DGVCSRows = new System.Windows.Forms.DataGridViewCellStyle();
            DGVCSRows.Font             = new System.Drawing.Font("宋体", 10F);
            DGVCSRows.ForeColor        = Color.FromArgb(51, 51, 51);
            DgvEx.RowsDefaultCellStyle = DGVCSRows;
            this.BringToFront();
            ((System.ComponentModel.ISupportInitialize)(DgvEx)).EndInit();

            this.Click   += new EventHandler(TextBoxDplDgv_Click);
            this.KeyDown += new KeyEventHandler(TextBoxDplDgv_KeyDown);



            this.Enter          += new EventHandler(TextBoxDplDgv_Enter);
            this.Leave          += new EventHandler(TextBoxDplDgv_Leave);
            this.PreviewKeyDown += new PreviewKeyDownEventHandler(TextBoxDplDgv_PreviewKeyDown);

            DgvEx.KeyDown         += new KeyEventHandler(DgvEx_KeyDown);
            DgvEx.CellDoubleClick += new DataGridViewCellEventHandler(DgvEx_CellDoubleClick);

            DgvEx.LostFocus += new EventHandler(DgvEx_LostFocus);

            DgvEx.CellFormatting += new DataGridViewCellFormattingEventHandler(DgvEx_CellFormatting);
        }
Exemple #2
0
        /// <summary>
        /// 加载汇总行
        /// </summary>
        private void InitDgvTotalRow()
        {
            if (this.dgvTotalRow != null)
            {
                return;
            }
            this.dgvTotalRow = new DataGridViewEx();

            this.dgvTotalRow.Hide();
            this.dgvTotalRow.ScrollBars                  = ScrollBars.None;
            this.dgvTotalRow.ColumnHeadersVisible        = false;
            this.dgvTotalRow.AllowUserToAddRows          = false;
            this.dgvTotalRow.AllowUserToDeleteRows       = false;
            this.dgvTotalRow.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.dgvTotalRow.Name = "dgvTotalRow";
            this.dgvTotalRow.RowTemplate.Height = 23;
            this.dgvTotalRow.SelectionMode      = DataGridViewSelectionMode.FullRowSelect;

            System.Windows.Forms.DataGridViewCellStyle DGVCSColumn = new System.Windows.Forms.DataGridViewCellStyle();
            DGVCSColumn.BackColor = System.Drawing.SystemColors.Control;
            this.dgvTotalRow.ColumnHeadersDefaultCellStyle = DGVCSColumn;


            //行边框颜色
            this.dgvTotalRow.GridColor = Color.FromArgb(242, 233, 223);
            //行字体颜色
            System.Windows.Forms.DataGridViewCellStyle DGVCSRows = new System.Windows.Forms.DataGridViewCellStyle();
            DGVCSRows.Font      = new Font("宋体", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
            DGVCSRows.ForeColor = Color.FromArgb(51, 51, 51);
            DGVCSRows.BackColor = Color.FromArgb(246, 236, 230);
            this.dgvTotalRow.RowsDefaultCellStyle     = DGVCSRows;
            this.dgvTotalRow.AllowUserToResizeColumns = false;

            this.dgvTotalRow.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            this.dgvTotalRow.BackgroundColor   = Color.FromArgb(250, 245, 241);
            this.dgvTotalRow.BorderStyle       = BorderStyle.None;
            this.dgvTotalRow.RowHeadersVisible = false;

            ((System.ComponentModel.ISupportInitialize)(dgvTotalRow)).EndInit();
        }
Exemple #3
0
        /// <summary>
        /// 创建DataGridView
        /// </summary>
        private void InitDataGridView()
        {
            this.dgvList = new DataGridViewEx();

            DgvList.Hide();

            DgvList.AllowUserToAddRows    = false;
            DgvList.AllowUserToDeleteRows = false;
            DgvList.AutoSizeColumnsMode   = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.DisplayedCells;
            DgvList.SelectionMode         = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
            DgvList.BackgroundColor       = System.Drawing.SystemColors.Window;
            DgvList.BorderStyle           = System.Windows.Forms.BorderStyle.Fixed3D;
            DgvList.RowHeadersVisible     = false;
            DgvList.EditMode = DataGridViewEditMode.EditProgrammatically;
            DgvList.BringToFront();
            ((System.ComponentModel.ISupportInitialize)(DgvList)).EndInit();
            DgvList.KeyDown         += new KeyEventHandler(dgvList_KeyDown);
            DgvList.CellDoubleClick += new DataGridViewCellEventHandler(dgvList_CellDoubleClick);

            DgvList.KeyDown         += new KeyEventHandler(dgvList_KeyDown);
            DgvList.CellDoubleClick += new DataGridViewCellEventHandler(dgvList_CellDoubleClick);
        }