自作ツール更新。PicoPicoTimer ver1.1.8β

自作ツール更新。
ガラクタツール置き場はこちら→https://nln.jp/software/

2017-12-28
[PicoPicoTimer ver1.1.8β]
・Tabでフォーカスを移動したときなど、数値を全選択するように修正。
・削除処理の空白処理追加。(追記1.1.8)

微々たる修正。です。
自己満足:カーソル移動と数値削除が大分それらしい動きになった!ヽ(*^。^*)ノ

モニタが省エネモードで消えていると最初の音が出ないとかありますが…(・・ゞポリポリ
当たり前ですよね。モニタの復帰時間なんて分かりませんもの。
設定増やすか…

—-
MSDNありがたや~。

手順 5: NumericUpDown コントロールの Enter イベント ハンドラーの追加
https://msdn.microsoft.com/ja-jp/library/dd492138.aspx

private void answer_Enter(object sender, EventArgs e)
{
// Select the whole answer in the NumericUpDown control.
NumericUpDown answerBox = sender as NumericUpDown;

if (answerBox != null)
{
int lengthOfAnswer = answerBox.Value.ToString().Length;
answerBox.Select(0, lengthOfAnswer);
}
}
カーソル移動後、削除した時の「空白」挙動が「一般的」になるよう修正。

(非推奨)NumericUpDown.TextChanged イベントのついか
https://msdn.microsoft.com/ja-jp/library/system.windows.forms.numericupdown.textchanged

参考:C#の質問です
https://oshiete.goo.ne.jp/qa/9467513.html

—-力ら技でまとめるとこんな感じ?
public PicoPicoTimer()
{
InitializeComponent();

this.numericUpDownHours.TextChanged += new System.EventHandler(this.numericUpDownHours_TextChanged);
this.numericUpDownMinutes.TextChanged += new System.EventHandler(this.numericUpDownMinutes_TextChanged);
this.numericUpDownSeconds.TextChanged += new System.EventHandler(this.numericUpDownSeconds_TextChanged);
}

private void numericUpDown_SelectAll(NumericUpDown answerBox)
{
// Select the whole answer in the NumericUpDown control.
// NumericUpDown answerBox = sender as NumericUpDown;
// NumericUpDown answerBox = numericUpDownSeconds;

if (answerBox != null)
{
int lengthOfAnswer = answerBox.Value.ToString().Length;
answerBox.Select(0, lengthOfAnswer);
}
}

private void checkBoxTopMost_CheckedChanged(object sender, EventArgs e)
{
this.TopMost = Settings.Instance.TopMost = checkBoxTopMost.Checked;
}

private void numericUpDownHours_Enter(object sender, EventArgs e)
{
numericUpDown_SelectAll(numericUpDownHours);
}

private void numericUpDownMinutes_Enter(object sender, EventArgs e)
{
numericUpDown_SelectAll(numericUpDownMinutes);
}

private void numericUpDownSeconds_Enter(object sender, EventArgs e)
{
numericUpDown_SelectAll(numericUpDownSeconds);
}

private void numericUpDownHours_TextChanged(object sender, EventArgs e)
{
if (numericUpDownHours.Text == “”)
{
// If the value in the numeric updown is an empty string, replace with 0.
numericUpDownHours.Text = “0”;
numericUpDown_SelectAll(numericUpDownHours);
}
}

private void numericUpDownMinutes_TextChanged(object sender, EventArgs e)
{
if (numericUpDownMinutes.Text == “”)
{
// If the value in the numeric updown is an empty string, replace with 0.
numericUpDownMinutes.Text = “0”;
numericUpDown_SelectAll(numericUpDownMinutes);
}
}

private void numericUpDownSeconds_TextChanged(object sender, EventArgs e)
{
if (numericUpDownSeconds.Text == “”)
{
// If the value in the numeric updown is an empty string, replace with 0.
numericUpDownSeconds.Text = “0”;
numericUpDown_SelectAll(numericUpDownSeconds);
}
}