G
Graeme
Hello, really hope you guys can help.
I'm using a standard NumericUpDown control on a form, and trying to change
the increment depending if a Control.ModifierKeys is pressed when the mouse
scrollwheel is moved.
Default increment is 0.5
When Keys.Control is pressed and I roll the mousewheel, the increment is
adjusted to 5 and the ValueChanged event firest. Great.
But when Keys.Shift is pressed and I roll the mousewheel, the increment is
adjust to 1 BUT ValueChanged does not fire, so the value in NumericUpDown
doesn't get adjusted. Not so great. I'm really confused as to why Shift
would not cause ValueChanged to fire.
Here's the little bit of code :
private System.Windows.Forms.NumericUpDown numPrice;
this.numPrice = new System.Windows.Forms.NumericUpDown();
private void numPrice_MouseWheel(object sender,
System.Windows.Forms.MouseEventArgs e)
{
//check it's capturing
if (Control.ModifierKeys == Keys.Shift)
{
numPrice.Increment = 1;
}
else if (Control.ModifierKeys == Keys.Control)
{
numPrice.Increment = 5;
}
}
I guess I can manually fire ValueChanged after Shift and bodge it in some way?
Really starting to lose my mind over this...
I'm using a standard NumericUpDown control on a form, and trying to change
the increment depending if a Control.ModifierKeys is pressed when the mouse
scrollwheel is moved.
Default increment is 0.5
When Keys.Control is pressed and I roll the mousewheel, the increment is
adjusted to 5 and the ValueChanged event firest. Great.
But when Keys.Shift is pressed and I roll the mousewheel, the increment is
adjust to 1 BUT ValueChanged does not fire, so the value in NumericUpDown
doesn't get adjusted. Not so great. I'm really confused as to why Shift
would not cause ValueChanged to fire.
Here's the little bit of code :
private System.Windows.Forms.NumericUpDown numPrice;
this.numPrice = new System.Windows.Forms.NumericUpDown();
private void numPrice_MouseWheel(object sender,
System.Windows.Forms.MouseEventArgs e)
{
//check it's capturing
if (Control.ModifierKeys == Keys.Shift)
{
numPrice.Increment = 1;
}
else if (Control.ModifierKeys == Keys.Control)
{
numPrice.Increment = 5;
}
}
I guess I can manually fire ValueChanged after Shift and bodge it in some way?
Really starting to lose my mind over this...