Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- setInterval clear
- listener 1883
- setInterval 외부 정지
- pm2 상태 확인
- pm2
- DatePicker
- mosquitto
- AntDesign
- transfer
- pm2 시작
- 서버동기화
- 맥 어드레스
- mosquitto.conf
- timepicker
- 공인IP
- setInterval 중지
- Replication
- pm2 설치
- invalid data
- map이 undefined가 뜰 때
- 1883
- DataGridView 직접 입력
- c# datagridview 데이터 넣기
- html #select #option #multiple
- datagridview 직접입력
- setInterval 정지
- 데이터테이블 데이터 넣기
- allow_anonymouse
- pm2 확인
- mySQL_Replication
Archives
- Today
- Total
개발 노트
특정셀값 색깔연습 본문
using System;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
namespace WindowsFormsApp3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
DataTable dt = GetData();
this.dataGridView1.DataSource = dt;
//머리글 셀을 포함하여 열에 있는 모든 셀의 내용에 맞도록 열 너비가 조정됩니다.
this.dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
//Cell값을 확인 후 Cell의 스타일 변경
foreach (DataGridViewRow row in this.dataGridView1.Rows)
{
foreach(DataGridViewCell cell in row.Cells)
{
if(cell.Value.ToString() == "과학" || cell.Value.ToString() == "수학")
{
DataGridViewCellStyle cellStyle = new DataGridViewCellStyle();
cellStyle.BackColor = Color.Blue;
cellStyle.Font = new Font("굴림", 10, FontStyle.Bold);
cell.Style = cellStyle;
}
}
}
}
private DataTable GetData()
{
DataTable dt = new DataTable();
dt.Columns.Add("과목", typeof(string));
dt.Columns.Add("점수", typeof(int));
dt.Rows.Add("과학", 4235);
dt.Rows.Add("수학", 1540);
dt.Rows.Add("국어", 660);
dt.Rows.Add("영어", 2640);
return dt;
}
}
}
'프로그래밍 > C#' 카테고리의 다른 글
수정 삭제 조회 활성화 (0) | 2022.02.15 |
---|---|
sql join query (0) | 2022.02.15 |
아이콘 무료사이트 (0) | 2022.02.14 |
개체번호 컬럼 타이틀 바꾸기 (0) | 2022.02.09 |
라디오버튼 체크하기 (0) | 2022.02.09 |