ใส่สีของ DataGridView


Win App (DataGridView)

private void DataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)

{

int iRow = e.RowIndex;
DataGridViewRow r = DataGridView1.Rows[iRow];
double cellValue = Convert.ToDouble (r.Cells[5].Value); //UnitPrice

if (cellValue <= 20)// ราคา/หน่วย ที่ < = 20
{

      r.DefaultCellStyle.BackColor = Color.Yellow ;
      r.DefaultCellStyle.ForeColor = Color.Red;
}

}

อ่านเพิ่มเติมได้ที่: Greatfriends.biz:=> กำหนดสีของ DataGridView

 

เกี่ยวกับ

Seasoned Senior System Analyst & Developer with over a decade of experience in designing, analyzing, and developing highperformance, scalable applications using a wide range of technologies, including Java, Spring Boot, C#, ASP.NET, MVC, React.js, Kubernetes, Microservices, PostgreSQL, MySQL, Oracle, and Microsoft SQL. Notable Achievements: Consistently delivered projects on time and within budget, ensuring client satisfaction and project success. Demonstrated versatility in working both independently and as a valuable team member, contributing to collaborative achievements. Honored with the prestigious "Employee of the Year" award in 2012 for exceptional dedication and outstanding performance. Recognized as a Microsoft Most Valuable Professional (MVP) for significant contributions to the software development community. My Commitment: I am committed to innovation, excellence, and solving complex technical challenges. I take pride in my ability to consistently deliver robust and efficient software solutions that meet and exceed the expectations of clients and stakeholders.

เขียนใน Windows Application

ใส่ความเห็น

In Archive