如果我的某个按钮被选中并且鼠标滚轮被激活,那么它的大小应该根据鼠标滚轮动作而改变。 如果鼠标滚轮上升,我的按钮大小应该增加2。 如果鼠标滚轮向下移动,我按钮的大小应减少2。
我正在尝试这样的事情:
var a = '[{"SNO":1,"SNUMBER":"827","STARTDATE":"11/12/2016","STARTTIME":"03:06:50 PM","ITEMNAME":"KBand","ITEMCODE":"KB2541","ITEMSKUNAME":"Band","ITEMSKUCODE":"BT102","SALESRATE":100.0,"PURCHASERATE":5.0,"DOE":"~","STOCKQTY":2.0,"PHYSICALQTY":1.0}]'
var output = JSON.parse(a)
console.log(output[0].PHYSICALQTY)
不幸的是我的代码不起作用。
答案 0 :(得分:1)
现在已经解决了:
private void Form1_Load(object sender, EventArgs e)
{
foreach (Control c in this.Controls)
{
btn = c as Button;
{
if (btn == null)
continue;
c.MouseWheel += c_MouseWheel;
}
}
}
private void c_MouseWheel(object sender, MouseEventArgs e)
{
ss = sender as Button;
TabControl tabControl = sender as TabControl;
int y = ss.Size.Width;
int x = ss.Size.Height;
if (e.Delta < 0)
{
ss.Size = new Size(y+2, x+2);
}
else
{
ss.Size = new Size(y-2, x-2);
}