触摸屏 - DataGridView不滚动到最后 [英] Touch screen - DataGridView not scrolling to the end
问题描述
当我使用触摸屏scrool它不会结束。
当我使用鼠标使用鼠标时,它会结束。
由于我上次触摸屏相关的问题没有得到太多的爱或回答我制作了一个视频,以更好地展示我的问题:链接到视频
如你所见,当我使用触摸屏时,有一个记录缺失,当我用鼠标进入scrool吧,就像DataGridView添加了另一条记录。这是不止一行。
任何建议?
信息:
应用程序正在获胜10.
制作.net(c#)(框架4)
编辑:
现在我正在尝试这个,但它仍然是不可预测的
int totalHeight = 0;
foreach(dataGridView1.Rows中的DataGridViewRow行)
totalHeight + = row.Height;
MessageBox.Show(Total H:+ totalHeight.ToString()+Height:+ dataGridView1.Height.ToString()+VO:+ dataGridView1.VerticalScrollingOffset);
if(totalHeight - dataGridView1.Height< dataGridView1.VerticalScrollingOffset)
{
int diferenca = dataGridView1.RowCount - (dataGridView1.FirstDisplayedScrollingRowIndex + dataGridView1.DisplayedRowCount(false));
MessageBox.Show(Diferenca-+ diferenca.ToString()+RowCount-+ dataGridView1.RowCount +Soma-+(dataGridView1.FirstDisplayedScrollingRowIndex + dataGridView1.DisplayedRowCount(false))) ;
if(diferenca!= 0)
{
dataGridView1.FirstDisplayedScrollingRowIndex = dataGridView1.FirstDisplayedScrollingRowIndex + diferenca;
}
}
尝试通过设置VerticalScrollingOffset来编程地执行此操作:
也许这是有帮助的:以编程方式设置VerticalScrollingOffset
I have an application running on a touch screen. In it i have a DataGridView, and i have this problem:
When i scrool it using the touch screen it does not go to the end.
When i scrool it using the mouse it does go to the end.
Since my last touch screen related question did not get much love or answer i made a video to better demonstrate my problem: LINK TO THE VIDEO
As u can see, when i use the touch screen there is a record missing and when i go to the scrool bar with the mouse its like the DataGridView adds another record. This has happen with more than just 1 row.
Any suggestions ?
Info:
App is running on win 10. Made in .net(c#)(framework 4)
EDIT:
right now i am trying this but its still too unpredictable
int totalHeight = 0;
foreach (DataGridViewRow row in dataGridView1.Rows)
totalHeight += row.Height;
MessageBox.Show("Total H: " + totalHeight.ToString() + " Height: " + dataGridView1.Height.ToString() + " VO: " + dataGridView1.VerticalScrollingOffset);
if (totalHeight - dataGridView1.Height < dataGridView1.VerticalScrollingOffset)
{
int diferenca = dataGridView1.RowCount - (dataGridView1.FirstDisplayedScrollingRowIndex + dataGridView1.DisplayedRowCount(false));
MessageBox.Show("Diferenca- " + diferenca.ToString() + "RowCount- " + dataGridView1.RowCount + "Soma- " + (dataGridView1.FirstDisplayedScrollingRowIndex + dataGridView1.DisplayedRowCount(false)));
if (diferenca != 0)
{
dataGridView1.FirstDisplayedScrollingRowIndex = dataGridView1.FirstDisplayedScrollingRowIndex + diferenca;
}
}
Try to do it programatically by setting VerticalScrollingOffset:
maybe this is helpful: setting VerticalScrollingOffset programmatically
这篇关于触摸屏 - DataGridView不滚动到最后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!