【发布时间】:2014-07-26 13:36:21
【问题描述】:
我有一个 Windows 窗体项目,我想在其中实现滚动。我试图使用this question的第二个答案
所以现在我的代码如下所示:
void pictureBox1_MouseWheel(object sender, MouseEventArgs e)
{
if (e.Delta != 0)
{
if (e.Delta <= 0)
{
//set minimum size to zoom
if (pictureBox1.Width < 50)
return;
}
else
{
//set maximum size to zoom
if (pictureBox1.Width > 500)
return;
}
pictureBox1.Width += Convert.ToInt32(pictureBox1.Width * e.Delta / 1000);
pictureBox1.Height += Convert.ToInt32(pictureBox1.Height * e.Delta / 1000);
}
但它只表现得像this
【问题讨论】:
标签: c# visual-studio scroll zooming mousewheel