| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 | 29 | 30 | 31 |
Tags
- theme
- Resident Evil
- gitea
- Gitea GPG
- 깃티
- Header
- c#
- DataTable
- Capcom
- 깃티gpg
- LogonUI
- 시놀로지
- checkbox
- Resident
- gitea설치
- unable to boot the simulator
- toroisegit
- 트레이아이콘
- Column
- 젤리핀
- jellyfin
- DataGridView
- 깃티설치
- Dokcer
- Re
- gfd
- 시놀로지깃티설치
- trayicon
- synology
- Gitea 설치
Archives
- Today
- Total
C O D I N G
DataGridView RowHeader에 숫자 넣는법 본문
DataGridView 이벤트에서 RowPostPaint를 추가하고
아래와 같이 코드를 넣으면 된다.
// 주석은 16진수 (4자리)
private void Gridview_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e) { DataGridView grid = sender as DataGridView; //String rowIdx = (e.RowIndex + 1).ToString("X4"); String rowIdx = (e.RowIndex + 1).ToString(); StringFormat centerFormat = new StringFormat() { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center }; Rectangle headerBounds = new Rectangle(e.RowBounds.Left, e.RowBounds.Top, grid.RowHeadersWidth, e.RowBounds.Height); e.Graphics.DrawString(rowIdx, this.Font, SystemBrushes.ControlText, headerBounds,centerFormat); }
'Programming > C#' 카테고리의 다른 글
| DataTable 사용방법 (0) | 2016.08.14 |
|---|---|
| ComboBox에 항목별로 Tag를 사용하는 방법 (DataTable) (0) | 2016.08.14 |
| xml Element (0) | 2016.08.02 |
| TrayIcon 좌클릭, 우클릭 메뉴 가능하게 하기 (0) | 2016.04.25 |
| 메시지박스 자동 종료하기 (0) | 2016.04.24 |