12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace wispro.sp.winform
- {
- public partial class frmExcelViewer : Form
- {
- public frmExcelViewer()
- {
- InitializeComponent();
- }
- private DataTable _data;
- public DataTable Data {
- get {
- return _data;
- }
- set
- {
- _data = value ;
- if(_data != null)
- {
-
- dataGridView1.DataSource = _data;
-
- }
- }
- }
- private void dataGridView1_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
- {
- Rectangle rect = new Rectangle(e.RowBounds.Location.X, e.RowBounds.Location.Y,
- dataGridView1.RowHeadersWidth - 4, e.RowBounds.Height);
- TextRenderer.DrawText(e.Graphics, (e.RowIndex + 1).ToString(),
- dataGridView1.RowHeadersDefaultCellStyle.Font, rect,
- dataGridView1.RowHeadersDefaultCellStyle.ForeColor,
- TextFormatFlags.VerticalCenter | TextFormatFlags.Right);
- }
- }
- }
|