일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- Numpy
- Series
- pandas
- javascript
- pycharm
- SciPy
- 알고리즘
- RNN
- dataframe
- keras
- Splunk
- mean
- Button
- 삼성소프트웨어멤버십
- install
- CNN
- synology
- E-P1
- Python
- DFS
- ipad
- GT-S80
- LSTM
- index
- pip
- mariadb
- imread
- SPL
- GitHub
- Lotto
Archives
- Today
- Total
잠토의 잠망경
DataGridView AutoScroll question 본문
DataGridView AutoScroll question
Can someone please demonstrate how to use the .AutoScrollOffset method on of the DGV control? I would like to scroll the current row so that it is positioned about halfway in the visible portion of the control. Thanks...
Re: DataGridView AutoScroll question
The .AutoScrollOffset method has nothing to do with the Rows inside of the DataGridView.
To accomplish what you are trying to do, you should use the FirstDisplayedCell property along with the DisplayedRowCount property to figure out how to position your cells correctly. An example of using the FirstDisplayedCell:
To accomplish what you are trying to do, you should use the FirstDisplayedCell property along with the DisplayedRowCount property to figure out how to position your cells correctly. An example of using the FirstDisplayedCell:
Code:
DataGridView1.Rows(85).Selected = True DataGridView1.FirstDisplayedCell = DataGridView1.Rows(82).Cells(0)
This code would make my selected cell #85, the fourth cell down in the list.
------------------------------------------------------------------------------
정정합니다.
foreach (DataGridViewRow r1 in dataGridView1.Rows)
{
if (sRow != null)
{
sRow.Cells[0].Style.BackColor = Color.White;
sRow.Cells[1].Style.BackColor = Color.White;
sRow.Selected = false;
}
if (Convert.ToString(r1.Cells[0].Value) == "0x" + Convert.ToString(DGVvalue, 16))
{
r1.Cells[0].Style.BackColor = Color.LightBlue;
r1.Cells[1].Style.BackColor = Color.LightBlue;
sRow = r1;
r1.Selected = true;
dataGridView1.FirstDisplayedCell = r1.Cells[0];
Comments