mirror of
https://git.femboyfinancial.jp/james/lipsync.git
synced 2025-02-18 00:19:02 -08:00
45 lines
1.4 KiB
C#
45 lines
1.4 KiB
C#
/*
|
|
* NumericUpDownEx.cs
|
|
* Copyright (c) 2007-2009 kbinani
|
|
*
|
|
* This file is part of LipSync.
|
|
*
|
|
* LipSync is free software; you can redistribute it and/or
|
|
* modify it under the terms of the BSD License.
|
|
*
|
|
* LipSync is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
*/
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Drawing;
|
|
//using System.Data;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
namespace LipSync {
|
|
/// <summary>
|
|
/// MouseWheelでIncrementずつ値を増減させることのできるNumericUpDown
|
|
/// </summary>
|
|
public partial class NumericUpDownEx : NumericUpDown {
|
|
public NumericUpDownEx() {
|
|
InitializeComponent();
|
|
}
|
|
protected override void OnMouseWheel( MouseEventArgs e ) {
|
|
decimal new_val;
|
|
if ( e.Delta > 0 ) {
|
|
new_val = this.Value + this.Increment;
|
|
} else if ( e.Delta < 0 ) {
|
|
new_val = this.Value - this.Increment;
|
|
} else {
|
|
return;
|
|
}
|
|
if ( this.Minimum <= new_val && new_val <= this.Maximum ) {
|
|
this.Value = new_val;
|
|
}
|
|
}
|
|
}
|
|
}
|