private void call(Byte f, char c) { if (TB.Text == String.Empty) { if (!(label1.Text == String.Empty)) { func = f; label1.Text = label1.Text.Remove(label1.Text.Length - 1); label1.Text = label1.Text + c; } } else { if (func == 0) { func = f; first = Double.Parse(TB.Text); label1.Text = TB.Text + c; TB.Clear(); } else { if (!(TB.Text == String.Empty)) { Func(); func = 0; } } } }
// funktion for operation private void Button_Opieration(object sender, RoutedEventArgs e) { Button button = (Button)sender; //TB.Text = TB.Text + button.Content; doubleA = ParseStringToDouble(TB.Text); //operation = button.Content.ToString(); switch (button.Content.ToString()) { case "/": operation = Operation.division; break; case "*": operation = Operation.multiplication; break; case "-": operation = Operation.minus; break; case "+": operation = Operation.plus; break; default: MessageBox.Show("blad dzialanai programu"); break; } LabelForOperation.Content = doubleA + button.Content.ToString(); TB.Clear(); }
private void SelectionChange_CB2(object sender, SelectionChangedEventArgs e) { TB.Clear(); if (CB2.SelectedIndex == 0) { TB.MaxLength = 5; } else if (CB2.SelectedIndex == 1) { TB.MaxLength = 6; } else if (CB2.SelectedIndex == 2) { TB.MaxLength = 7; } else if (CB2.SelectedIndex == 3) { TB.MaxLength = 8; } else { TB.MaxLength = 10; } textBlock_1.Text = TB.MaxLength.ToString(); TB.IsEnabled = true; }
// function for numbers private void Button_Click(object sender, RoutedEventArgs e) { if (TB.Text == "0") { TB.Clear(); } Button button = (Button)sender; TB.Text = TB.Text + button.Content.ToString(); //string a = button.Content.ToString(); //doubleA = ParseStringToDouble(button.Content.ToString()); }
private void btn_proc_Click(object sender, EventArgs e) { if (func == 0) { func = 5; first = Double.Parse(TB.Text); label1.Text = TB.Text + " %"; TB.Clear(); } else { Func(); func = 0; } }
// IME変換中の判定は、こちらのblogを参考にさせて頂きました。 // https://yone64.wordpress.com/2010/10/25/ime%E3%81%A7%E5%A4%89%E6%8F%9B%E7%8A%B6%E6%85%8B%E4%B8%AD%E3%81%A7%E3%82%82textbox-textchanged%E3%81%8C%E7%99%BA%E7%94%9F%E3%81%99%E3%82%8B/ private async void TB_TextChanged(object sender, TextChangedEventArgs e) { if (_imeFlag) { return; } //IMEで確定した場合のみ、ここに入る string kanji = string.Copy(TB.Text); // TBをクリアするので、コピーしておく。 if (kanji != "") { // 文字が入力されていたら、送信する await SendKanjiAsync(kanji); } TB.Clear(); }
private void Clear_Click(object sender, RoutedEventArgs e) => TB.Clear();
private void buttonC_Click(object sender, EventArgs e) { TB.Clear(); }
//handling keybord private void GridKey(object sender, KeyEventArgs e) { //clear textBox if is 0 or null if (TB.Text == "0" || number == true) { TB.Clear(); } //insert number from keybord switch (e.Key) { case Key.NumPad7: TB.Text = TB.Text + "7"; break; case Key.NumPad8: TB.Text = TB.Text + "8"; break; case Key.NumPad9: TB.Text = TB.Text + "9"; break; case Key.NumPad4: TB.Text = TB.Text + "4"; break; case Key.NumPad5: TB.Text = TB.Text + "5"; break; case Key.NumPad6: TB.Text = TB.Text + "6"; break; case Key.NumPad1: TB.Text = TB.Text + "1"; break; case Key.NumPad2: TB.Text = TB.Text + "2"; break; case Key.NumPad3: TB.Text = TB.Text + "3"; break; case Key.NumPad0: TB.Text = TB.Text + "0"; break; case Key.D1: TB.Text = TB.Text + "1"; break; case Key.D2: TB.Text = TB.Text + "2"; break; case Key.D3: TB.Text = TB.Text + "3"; break; case Key.D4: TB.Text = TB.Text + "4"; break; case Key.D5: TB.Text = TB.Text + "5"; break; case Key.D6: TB.Text = TB.Text + "6"; break; case Key.D7: TB.Text = TB.Text + "7"; break; case Key.D8: TB.Text = TB.Text + "8"; break; case Key.D9: TB.Text = TB.Text + "9"; break; case Key.D0: TB.Text = TB.Text + "0"; break; //button for division case Key.Divide: Button sender2; sender2 = new Button() { Content = "/" }; Button_Opieration(sender2, null); break; //button for score case Key.Enter: Button_Click_score(null, null); break; // button for plus keboard case Key.OemPlus: sender2 = new Button() { Content = "+" }; Button_Opieration(sender2, null); break; // button for plus keypad case Key.Add: sender2 = new Button() { Content = "+" }; Button_Opieration(sender2, null); break; // button for minus keboard case Key.OemMinus: sender2 = new Button() { Content = "-" }; Button_Opieration(sender2, null); break; // button for minus keypad case Key.Subtract: sender2 = new Button() { Content = "-" }; Button_Opieration(sender2, null); break; // button for multiplication case Key.Multiply: sender2 = new Button() { Content = "*" }; Button_Opieration(sender2, null); break; // button for comma case Key.Decimal: Button_Click_comma(null, null); break; default: break; } }