반응형
private void Mouse_Wheel(object sender, MouseEventArgs e)
{
if (e.Delta < 0) //스크롤 내릴때
{
if (this.vScrollBar1.Value + Math.Abs(e.Delta) > this.vScrollBar1.Maximum)
{
this.vScrollBar1.Value = this.vScrollBar1.Maximum;
}
else
{
this.vScrollBar1.Value = this.vScrollBar1.Value + Math.Abs(e.Delta);
}
}
else if (e.Delta > 0 && this.vScrollBar1.Value > 0) //스크롤 올릴때
{
if (this.vScrollBar1.Value - Math.Abs(e.Delta) < 0)
{
this.vScrollBar1.Value = 0;
}
else
{
this.vScrollBar1.Value = this.vScrollBar1.Value - Math.Abs(e.Delta);
}
}
}
반응형
'코딩 > C#' 카테고리의 다른 글
[C#] 남아있는 Process Kill (0) | 2017.03.31 |
---|---|
[C#] Global Keyboard Hooking (0) | 2017.03.23 |
[코딩] Linefeed 방지 (0) | 2017.02.17 |
[코딩] 3 (0) | 2017.01.24 |
[코딩] 2 (0) | 2017.01.24 |