| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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
- 시놀로지
- Resident
- gitea
- 깃티gpg
- DataTable
- jellyfin
- 젤리핀
- gitea설치
- unable to boot the simulator
- gfd
- Gitea 설치
- DataGridView
- Column
- LogonUI
- Gitea GPG
- trayicon
- Re
- Capcom
- Resident Evil
- theme
- CmdKey
- 깃티
- 트레이아이콘
- toroisegit
- c#
- Header
- 깃티설치
- 시놀로지깃티설치
- synology
- checkbox
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 |