zoukankan      html  css  js  c++  java
  • 15.10DataGridView隔行显示不同的颜色

    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 _15._10DataGridView隔行显示不同颜色
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
    
            private void Form1_Load(object sender, EventArgs e)
            {
                // TODO: 这行代码将数据加载到表“csharpzxwDataSet.mytable001”中。您可以根据需要移动或删除它。
                this.mytable001TableAdapter.Fill(this.csharpzxwDataSet.mytable001);
                //for (int i = 0; i < this.dataGridView1.Rows.Count; i++) //第一种方式
                //{
                //    if (i % 2 == 0)
                //        this.dataGridView1.Rows[i].DefaultCellStyle.BackColor = Color.Pink;
                //    else
                //        this.dataGridView1.Rows[i].DefaultCellStyle.BackColor = Color.Violet;
    
                //}
                this.dataGridView1.DefaultCellStyle.BackColor = Color.Beige;
                this.dataGridView1.AlternatingRowsDefaultCellStyle.BackColor = Color.SandyBrown;
    
            }
    
            private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
            {
    
            }
        }
    }
  • 相关阅读:
    BZOJ 1576 树剖+LCT
    CF1051D Bicolorings 递推
    CF938D Buy a Ticket dijkstra
    记一次创建svc代理失败
    K8S中Service
    K8S中的Job和CronJob
    K8S中DaemonSet
    Linux expect介绍和用法
    Java根据余弦定理计算文本相似度
    Python和Sublime的整合
  • 原文地址:https://www.cnblogs.com/zqyo2000z/p/5414450.html
Copyright © 2011-2022 走看看