用C#的trackbar控件对图片放大,缩小,但对这程序意思不太懂,求高手帮忙解释下了。。
privatevoidtrackBar2_Scroll(objectsender,EventArgse){SingleLS=1;if(trackBar2.Value<10...
private void trackBar2_Scroll(object sender, EventArgs e)
{
Single LS = 1;
if (trackBar2.Value < 10)
{
LS = Convert.ToSingle(trackBar2.Value * 0.1);
}
if (trackBar2.Value == 10)
{
LS = 1;
}
else
{
if (trackBar2.Value > 10)
{
LS = Convert.ToSingle(trackBar2.Value - 10);
}
}
int pwidth = ig.Width;
int pheight = ig.Height;
ptbNewPic.Width = Convert.ToInt32(pwidth * LS);
ptbNewPic.Height = Convert.ToInt32(pheight * LS);
} 展开
{
Single LS = 1;
if (trackBar2.Value < 10)
{
LS = Convert.ToSingle(trackBar2.Value * 0.1);
}
if (trackBar2.Value == 10)
{
LS = 1;
}
else
{
if (trackBar2.Value > 10)
{
LS = Convert.ToSingle(trackBar2.Value - 10);
}
}
int pwidth = ig.Width;
int pheight = ig.Height;
ptbNewPic.Width = Convert.ToInt32(pwidth * LS);
ptbNewPic.Height = Convert.ToInt32(pheight * LS);
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询