8,833
社区成员
发帖
与我相关
我的任务
分享
Scroll += (sender, e) =>
{
if (e.ScrollOrientation == ScrollOrientation.HorizontalScroll
&& e.NewValue >= 0)
{
if (e.NewValue == 0)
{
var canScroll = !watch.IsRunning || watch.ElapsedMilliseconds > 200;
if (!canScroll)
{
e.NewValue = e.OldValue;
}
}
hScrollBar.Value = e.NewValue;
}
};
MouseUp += (sender, e) =>
{
if (e.Button == MouseButtons.Left)
{
if (e.Location.Y <= ColumnHeadersHeight)
{
watch.Reset();
watch.Start();
}
}
};
MouseClick += (sender, e) =>
{
if (e.Button == MouseButtons.Left)
{
if (e.Location.Y <= ColumnHeadersHeight)
{
watch.Reset();
watch.Start();
}
}
};
int index = dataGridView2.FirstDisplayedScrollingRowIndex;
dataGridView2.ScrollBars = ScrollBars.Vertical;
dataGridView2.FirstDisplayedScrollingRowIndex = index;