コード例 #1
0
        /// <summary>
        /// 初始化表格
        /// </summary>
        /// <param name="pDgv"></param>
        /// <param name="pColumnNames"></param>
        private void InitGrid(dgvHasRowNum pDgv, ModelColumnInfo[] pInfos)
        {
            DataTable  dt = new DataTable();
            DataColumn dc = null;

            foreach (ModelColumnInfo info in pInfos)
            {
                dc = new DataColumn(info.ColumnDescription);
                dt.Columns.Add(dc);
            }

            pDgv.DataSource = dt;
        }
コード例 #2
0
        /// <summary>
        /// 绑定数据
        /// </summary>
        /// <param name="pDestination">目的表格</param>
        /// <param name="pDataSource">数据源</param>
        /// <param name="pColnumNum">列数</param>
        private void BindData(dgvHasRowNum pDestination, DataTable pDataSource, int pColnumNum)
        {
            DataTable destinationTable = (DataTable)pDestination.DataSource;

            //先清空
            destinationTable.Rows.Clear();

            for (int i = 0; i < pDataSource.Rows.Count; i++)
            {
                DataRow newDR = destinationTable.NewRow();
                for (int j = 0; j < pColnumNum; j++)
                {
                    newDR[j] = pDataSource.Rows[i][j];
                }
                destinationTable.Rows.Add(newDR);
            }
        }
コード例 #3
0
        private void dgvHasRowNumDetl_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            dgvHasRowNum num = (dgvHasRowNum)sender;

            if (e.RowIndex < 0)
            {
                return;
            }
            if (num.Rows[e.RowIndex].Cells[e.ColumnIndex].ValueType == typeof(byte[]))
            {
                string tag = ImageOperation.CrateImageFileByBytes((byte[])num.Rows[e.RowIndex].Cells[e.ColumnIndex].Value);
                if (tag != null)
                {
                    new frmPreviewImage(tag)
                    {
                        MdiParent = base.ParentForm.MdiParent
                    }.Show();
                }
            }
        }
コード例 #4
0
 private void InitializeComponent()
 {
     System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
     System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
     this.toolStrip1                  = new System.Windows.Forms.ToolStrip();
     this.toolStripButtonNew          = new System.Windows.Forms.ToolStripButton();
     this.toolStripButtonQuery        = new System.Windows.Forms.ToolStripButton();
     this.toolStripButtonDelete       = new System.Windows.Forms.ToolStripButton();
     this.toolStripButtonEdit         = new System.Windows.Forms.ToolStripButton();
     this.toolStripButtonRefresh      = new System.Windows.Forms.ToolStripButton();
     this.toolStripButton1            = new System.Windows.Forms.ToolStripButton();
     this.toolStripButtonReport       = new System.Windows.Forms.ToolStripButton();
     this.toolStripButtonNormal       = new System.Windows.Forms.ToolStripButton();
     this.toolStripButtonExit         = new System.Windows.Forms.ToolStripButton();
     this.toolStripSplitButtonToExcel = new System.Windows.Forms.ToolStripSplitButton();
     this.快速ToolStripMenuItem         = new System.Windows.Forms.ToolStripMenuItem();
     this.格式ToolStripMenuItem         = new System.Windows.Forms.ToolStripMenuItem();
     this.dgvHasRowNumDetl            = new MSC.WinFormControlLib.dgvHasRowNum();
     this.toolStrip1.SuspendLayout();
     ((System.ComponentModel.ISupportInitialize)(this.dgvHasRowNumDetl)).BeginInit();
     this.SuspendLayout();
     //
     // toolStrip1
     //
     this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
         this.toolStripButtonNew,
         this.toolStripButtonQuery,
         this.toolStripButtonDelete,
         this.toolStripButtonEdit,
         this.toolStripButtonRefresh,
         this.toolStripSplitButtonToExcel,
         this.toolStripButton1,
         this.toolStripButtonReport,
         this.toolStripButtonNormal,
         this.toolStripButtonExit
     });
     this.toolStrip1.Location = new System.Drawing.Point(0, 0);
     this.toolStrip1.Name     = "toolStrip1";
     this.toolStrip1.Size     = new System.Drawing.Size(679, 35);
     this.toolStrip1.TabIndex = 0;
     this.toolStrip1.Text     = "toolStrip1";
     //
     // toolStripButtonNew
     //
     this.toolStripButtonNew.Image = global::MSC.WinFormControlLib.Resource1.New;
     this.toolStripButtonNew.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.toolStripButtonNew.Name = "toolStripButtonNew";
     this.toolStripButtonNew.Size = new System.Drawing.Size(33, 32);
     this.toolStripButtonNew.Text = "新增";
     this.toolStripButtonNew.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
     this.toolStripButtonNew.Click            += new System.EventHandler(this.toolStripButtonNew_Click);
     //
     // toolStripButtonQuery
     //
     this.toolStripButtonQuery.Image = global::MSC.WinFormControlLib.Resource1.Search;
     this.toolStripButtonQuery.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.toolStripButtonQuery.Name = "toolStripButtonQuery";
     this.toolStripButtonQuery.Size = new System.Drawing.Size(57, 32);
     this.toolStripButtonQuery.Text = "查询明细";
     this.toolStripButtonQuery.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
     this.toolStripButtonQuery.Click            += new System.EventHandler(this.toolStripButtonQuery_Click);
     //
     // toolStripButtonDelete
     //
     this.toolStripButtonDelete.Image = global::MSC.WinFormControlLib.Resource1.delete1;
     this.toolStripButtonDelete.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.toolStripButtonDelete.Name = "toolStripButtonDelete";
     this.toolStripButtonDelete.Size = new System.Drawing.Size(69, 32);
     this.toolStripButtonDelete.Text = "删除当前行";
     this.toolStripButtonDelete.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
     this.toolStripButtonDelete.Click            += new System.EventHandler(this.toolStripButtonDelete_Click);
     //
     // toolStripButtonEdit
     //
     this.toolStripButtonEdit.Image = global::MSC.WinFormControlLib.Resource1.EDIT;
     this.toolStripButtonEdit.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.toolStripButtonEdit.Name = "toolStripButtonEdit";
     this.toolStripButtonEdit.Size = new System.Drawing.Size(69, 32);
     this.toolStripButtonEdit.Text = "编辑当前行";
     this.toolStripButtonEdit.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
     this.toolStripButtonEdit.Click            += new System.EventHandler(this.toolStripButtonEdit_Click);
     //
     // toolStripButtonRefresh
     //
     this.toolStripButtonRefresh.Image = global::MSC.WinFormControlLib.Resource1.refresh;
     this.toolStripButtonRefresh.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.toolStripButtonRefresh.Name = "toolStripButtonRefresh";
     this.toolStripButtonRefresh.Size = new System.Drawing.Size(33, 32);
     this.toolStripButtonRefresh.Text = "刷新";
     this.toolStripButtonRefresh.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
     this.toolStripButtonRefresh.Click            += new System.EventHandler(this.toolStripButtonRefresh_Click);
     //
     // toolStripButton1
     //
     this.toolStripButton1.Image = global::MSC.WinFormControlLib.Resource1.打印;
     this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.toolStripButton1.Name = "toolStripButton1";
     this.toolStripButton1.Size = new System.Drawing.Size(57, 32);
     this.toolStripButton1.Text = "报表套打";
     this.toolStripButton1.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
     this.toolStripButton1.Click            += new System.EventHandler(this.toolStripButton1_Click);
     //
     // toolStripButtonReport
     //
     this.toolStripButtonReport.Image = global::MSC.WinFormControlLib.Resource1.打印;
     this.toolStripButtonReport.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.toolStripButtonReport.Name = "toolStripButtonReport";
     this.toolStripButtonReport.Size = new System.Drawing.Size(81, 32);
     this.toolStripButtonReport.Text = "表格样式打印";
     this.toolStripButtonReport.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
     this.toolStripButtonReport.Click            += new System.EventHandler(this.toolStripButtonReport_Click);
     //
     // toolStripButtonNormal
     //
     this.toolStripButtonNormal.Image = global::MSC.WinFormControlLib.Resource1.Print;
     this.toolStripButtonNormal.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.toolStripButtonNormal.Name = "toolStripButtonNormal";
     this.toolStripButtonNormal.Size = new System.Drawing.Size(69, 32);
     this.toolStripButtonNormal.Text = "无格式打印";
     this.toolStripButtonNormal.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
     this.toolStripButtonNormal.Click            += new System.EventHandler(this.toolStripButtonNormal_Click);
     //
     // toolStripButtonExit
     //
     this.toolStripButtonExit.Image = global::MSC.WinFormControlLib.Resource1.exit;
     this.toolStripButtonExit.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.toolStripButtonExit.Name = "toolStripButtonExit";
     this.toolStripButtonExit.Size = new System.Drawing.Size(33, 32);
     this.toolStripButtonExit.Text = "退出";
     this.toolStripButtonExit.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
     this.toolStripButtonExit.Click            += new System.EventHandler(this.toolStripButtonExit_Click);
     //
     // toolStripSplitButtonToExcel
     //
     this.toolStripSplitButtonToExcel.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
         this.快速ToolStripMenuItem,
         this.格式ToolStripMenuItem
     });
     this.toolStripSplitButtonToExcel.Image = global::MSC.WinFormControlLib.Resource1.excel;
     this.toolStripSplitButtonToExcel.ImageTransparentColor = System.Drawing.Color.Magenta;
     this.toolStripSplitButtonToExcel.Name = "toolStripSplitButtonToExcel";
     this.toolStripSplitButtonToExcel.Size = new System.Drawing.Size(75, 32);
     this.toolStripSplitButtonToExcel.Text = "导出Excel";
     this.toolStripSplitButtonToExcel.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
     this.toolStripSplitButtonToExcel.ButtonClick      += new System.EventHandler(this.快速ToolStripMenuItem_Click);
     //
     // 快速ToolStripMenuItem
     //
     this.快速ToolStripMenuItem.Name   = "快速ToolStripMenuItem";
     this.快速ToolStripMenuItem.Size   = new System.Drawing.Size(152, 22);
     this.快速ToolStripMenuItem.Text   = "快速";
     this.快速ToolStripMenuItem.Click += new System.EventHandler(this.快速ToolStripMenuItem_Click);
     //
     // 格式ToolStripMenuItem
     //
     this.格式ToolStripMenuItem.Name   = "格式ToolStripMenuItem";
     this.格式ToolStripMenuItem.Size   = new System.Drawing.Size(152, 22);
     this.格式ToolStripMenuItem.Text   = "格式";
     this.格式ToolStripMenuItem.Click += new System.EventHandler(this.格式ToolStripMenuItem_Click);
     //
     // dgvHasRowNumDetl
     //
     this.dgvHasRowNumDetl.AllowUserToAddRows    = false;
     this.dgvHasRowNumDetl.AllowUserToDeleteRows = false;
     dataGridViewCellStyle7.Alignment            = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
     dataGridViewCellStyle7.BackColor            = System.Drawing.SystemColors.Control;
     dataGridViewCellStyle7.Font                         = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
     dataGridViewCellStyle7.ForeColor                    = System.Drawing.SystemColors.WindowText;
     dataGridViewCellStyle7.SelectionBackColor           = System.Drawing.SystemColors.Highlight;
     dataGridViewCellStyle7.SelectionForeColor           = System.Drawing.SystemColors.HighlightText;
     dataGridViewCellStyle7.WrapMode                     = System.Windows.Forms.DataGridViewTriState.True;
     this.dgvHasRowNumDetl.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle7;
     this.dgvHasRowNumDetl.ColumnHeadersHeightSizeMode   = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
     dataGridViewCellStyle8.Alignment                    = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
     dataGridViewCellStyle8.BackColor                    = System.Drawing.SystemColors.Window;
     dataGridViewCellStyle8.Font                         = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
     dataGridViewCellStyle8.ForeColor                    = System.Drawing.SystemColors.ControlText;
     dataGridViewCellStyle8.SelectionBackColor           = System.Drawing.SystemColors.Highlight;
     dataGridViewCellStyle8.SelectionForeColor           = System.Drawing.SystemColors.HighlightText;
     dataGridViewCellStyle8.WrapMode                     = System.Windows.Forms.DataGridViewTriState.False;
     this.dgvHasRowNumDetl.DefaultCellStyle              = dataGridViewCellStyle8;
     this.dgvHasRowNumDetl.Dock                    = System.Windows.Forms.DockStyle.Fill;
     this.dgvHasRowNumDetl.Location                = new System.Drawing.Point(0, 35);
     this.dgvHasRowNumDetl.Name                    = "dgvHasRowNumDetl";
     this.dgvHasRowNumDetl.ReadOnly                = true;
     this.dgvHasRowNumDetl.RowTemplate.Height      = 23;
     this.dgvHasRowNumDetl.Size                    = new System.Drawing.Size(679, 464);
     this.dgvHasRowNumDetl.TabIndex                = 1;
     this.dgvHasRowNumDetl.CellContentDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvHasRowNumDetl_CellContentDoubleClick);
     //
     // frmManagerReward
     //
     this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
     this.AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Font;
     this.ClientSize          = new System.Drawing.Size(679, 499);
     this.Controls.Add(this.dgvHasRowNumDetl);
     this.Controls.Add(this.toolStrip1);
     this.Name        = "frmManagerReward";
     this.Text        = "管理公共";
     this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
     this.Load       += new System.EventHandler(this.frmManagerReward_Load);
     this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.frmManagerReward_FormClosed);
     this.toolStrip1.ResumeLayout(false);
     this.toolStrip1.PerformLayout();
     ((System.ComponentModel.ISupportInitialize)(this.dgvHasRowNumDetl)).EndInit();
     this.ResumeLayout(false);
     this.PerformLayout();
 }