在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
private void Form1_Load(object sender, EventArgs e) { DataTable table = new DataTable("Student"); DataColumn studentID = new DataColumn("studentID", typeof(string)); table.Columns.Add(studentID); DataColumn studentName = new DataColumn("studentName", typeof(string)); table.Columns.Add(studentName); DataColumn studentAmount = new DataColumn("studentAmount", typeof(decimal)); table.Columns.Add(studentAmount); DataRow dr1 = table.NewRow(); dr1["studentID"] = "2010092601"; dr1["studentName"] = "张三"; dr1["studentAmount"] = new decimal(3500.00); table.Rows.Add(dr1); DataRow dr2 = table.NewRow(); dr2["studentID"] = "2010092602"; dr2["studentName"] = "李四"; dr2["studentAmount"] = new decimal(4000.00); table.Rows.Add(dr2); dataGridView1.DataSource = table; dataGridView1.Columns[2].Width = 150; dataGridView1.Columns[2].DefaultCellStyle.Format = "c"; dataGridView1.Columns[2].SortMode = DataGridViewColumnSortMode.NotSortable; dataGridView1.Columns[2].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; dataGridView1.Columns[2].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight; dataGridView1.Columns[2].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleLeft; dataGridView1.Columns[2].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter; }
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论