• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Input.KeyEventArgs类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Windows.Input.KeyEventArgs的典型用法代码示例。如果您正苦于以下问题:C# KeyEventArgs类的具体用法?C# KeyEventArgs怎么用?C# KeyEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



KeyEventArgs类属于System.Windows.Input命名空间,在下文中一共展示了KeyEventArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: TrayWindow_KeyDown

 void TrayWindow_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Escape)
     {
         this.Close();
     }
 }
开发者ID:troelsrichter,项目名称:ShellLight,代码行数:7,代码来源:TrayWindow.xaml.cs


示例2: OnTextBoxKeyDown

        /// <summary>
        /// Occurs when the KeyDown event fires and the drop down is not open.
        /// </summary>
        /// <param name="e">The key event data.</param>
        protected void OnTextBoxKeyDown(KeyEventArgs e)
        {
            if (e == null)
            {
                throw new ArgumentNullException("e");
            }
            else if (e.Handled)
            {
                return;
            }

            switch (e.Key)
            {
                case Key.Down:
                    if (!IsDropDownOpen)
                    {
                        ToggleDropDown(this, e);
                        e.Handled = true;
                    }
                    break;

                case Key.F4:
                    ToggleDropDown(this, e);
                    e.Handled = true;
                    break;

                case Key.Enter:
                    OnAdapterSelectionComplete(this, new RoutedEventArgs());
                    e.Handled = true;
                    break;

                default:
                    break;
            }
        }
开发者ID:Mrding,项目名称:Ribbon,代码行数:39,代码来源:AutoCompleteBox.KeyBoard.cs


示例3: PasswordTxb_KeyDown

 private async void PasswordTxb_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         await LoadContacts();
     }
 }
开发者ID:BluePosition,项目名称:ApiSamples,代码行数:7,代码来源:MainWindow.xaml.cs


示例4: textBoxMessage_KeyDown

 private void textBoxMessage_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         ButtonSend_Click(sender, e);
     }
 }
开发者ID:pzwwei,项目名称:MyICQ,代码行数:7,代码来源:WindowDialog.xaml.cs


示例5: CommonTextBox_KeyUp

 private void CommonTextBox_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         base.Focus();
     }
 }
开发者ID:RukaiYu,项目名称:TinyMoneyManager.WP8,代码行数:7,代码来源:DataSyncingSettingPage.xaml.cs


示例6: TextBox1_KeyDown

 public void TextBox1_KeyDown(object sender, KeyEventArgs e)
 {
     e.Handled = false;
     System.Windows.Controls.TextBox textBox = TextBox1;
     if (e.Key == Key.Enter)
     {
         if (!Keyboard.IsKeyDown(Key.LeftShift))
             textBox.MoveFocus(traversalRequest);
         else
         {
             int i = textBox.CaretIndex;
             textBox.Text = textBox.Text.Substring(0, i) + "\n" + textBox.Text.Substring(i, textBox.Text.Length - i);
             textBox.CaretIndex = i + 1;
         }
     }
     else if (e.Key == Key.Subtract)
     {
         System.Windows.Controls.TextBox box = (System.Windows.Controls.TextBox)sender;
         int caret = box.CaretIndex;
         box.Text = box.Text.Insert(box.CaretIndex, "-");
         box.CaretIndex = caret + 1;
         e.Handled = true;
     }
     textBox.AppendText(String.Empty);
 }
开发者ID:juancampa,项目名称:Gearset,代码行数:25,代码来源:StringItem.xaml.cs


示例7: itemList_KeyDown

 private void itemList_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter && itemList.SelectedItems.Count == 1)
     {
         editButton_Click(sender, null);
     }
 }
开发者ID:Mavtak,项目名称:Arcadia,代码行数:7,代码来源:RepositoryListWindow.xaml.cs


示例8: KeyDown

        public void KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.Key)
            {
                case Key.K:
                    foreach (var label in Dane.tablica)
                    {
                        label.BorderThickness =
                            (label.BorderThickness == new Thickness(1))
                                ? label.BorderThickness = new Thickness(0)
                                : label.BorderThickness = new Thickness(1);
                    }
                    break;
                case Key.Left:
                    if (Wunsz.kierunek != Kierunek.right)
                        Wunsz.kierunek = Kierunek.left;
                    break;
                case Key.Up:
                    if (Wunsz.kierunek != Kierunek.down)
                        Wunsz.kierunek = Kierunek.up;
                    break;
                case Key.Right:
                    if (Wunsz.kierunek != Kierunek.left)
                        Wunsz.kierunek = Kierunek.right;
                    break;
                case Key.Down:
                    if (Wunsz.kierunek != Kierunek.up)
                        Wunsz.kierunek = Kierunek.down;
                    break;
                

            }

        }
开发者ID:MaciekAiR,项目名称:Snake,代码行数:34,代码来源:MainViewModel.cs


示例9: method_3

		private void method_3(object sender, KeyEventArgs e)
		{
			if (e.Key == Key.Return)
			{
				this.method_1();
			}
		}
开发者ID:akordowski,项目名称:Source-Code-Nitriq,代码行数:7,代码来源:RenameCategory.cs


示例10: DoKeyDown

 /// <summary>
 /// Close the window when the Esc key is pressed.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void DoKeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Escape)
     {
         Hide();
     }
 }
开发者ID:pengyancai,项目名称:cs-util,代码行数:12,代码来源:AboutBox.xaml.cs


示例11: studentsList_KeyDown

        // When the user presses a key, determine whether to add a new student to a class, remove a student from a class, or modify the details of a student
        private void studentsList_KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.Key)
            {
                // If the user pressed Enter, edit the details for the currently selected student
                case Key.Enter: Student student = this.studentsList.SelectedItem as Student;

                    // Use the StudentsForm to display and edit the details of the student
                    StudentForm sf = new StudentForm();

                    // Set the title of the form and populate the fields on the form with the details of the student
                    sf.Title = "Edit Student Details";
                    sf.firstName.Text = student.FirstName;
                    sf.lastName.Text = student.LastName;
                    sf.dateOfBirth.Text = student.DateOfBirth.ToString("d"); // Format the date to omit the time element

                    // Display the form
                    if (sf.ShowDialog().Value)
                    {
                        // When the user closes the form, copy the details back to the student
                        student.FirstName = sf.firstName.Text;
                        student.LastName = sf.lastName.Text;
                        student.DateOfBirth = DateTime.Parse(sf.dateOfBirth.Text);

                        // Enable saving (changes are not made permanent until they are written back to the database)
                        saveChanges.IsEnabled = true;
                    }
                    break;

                // If the user pressed Insert, add a new student
                case Key.Insert:

                    // Use the StudentsForm to get the details of the student from the user
                    sf = new StudentForm();

                    // Set the title of the form to indicate which class the student will be added to (the class for the currently selected teacher)
                    sf.Title = "New Student for Class " + teacher.Class;

                    // Display the form and get the details of the new student
                    if (sf.ShowDialog().Value)
                    {
                        // When the user closes the form, retrieve the details of the student from the form
                        // and use them to create a new Student object
                        Student newStudent = new Student();
                        newStudent.FirstName = sf.firstName.Text;
                        newStudent.LastName = sf.lastName.Text;
                        newStudent.DateOfBirth = DateTime.Parse(sf.dateOfBirth.Text);

                        // Assign the new student to the current teacher
                        this.teacher.Students.Add(newStudent);

                        // Add the student to the list displayed on the form
                        this.studentsInfo.Add(newStudent);

                        // Enable saving (changes are not made permanent until they are written back to the database)
                        saveChanges.IsEnabled = true;
                    }
                    break;
            }
        }
开发者ID:Rahul21Lal,项目名称:Main-Lab,代码行数:61,代码来源:MainWindow.xaml.cs


示例12: SearchTermTextBox_KeyDown

 private void SearchTermTextBox_KeyDown(object sender, KeyEventArgs e)
 {
     if(e.Key == Key.Enter && EnterCommand!=null)
     {
         EnterCommand(this, e);
     }
 }
开发者ID:alexiej,项目名称:YATE,代码行数:7,代码来源:TextBoxWatermark.xaml.cs


示例13: DecimalIpAddressTextBox_KeyUp

        private void DecimalIpAddressTextBox_KeyUp(object sender, KeyEventArgs e)
        {
            string RawInput;
            RawInput = DecimalIpAddressTextBox.Text.Trim();

            // CIDR regex
            string pattern = @"((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)";
            Regex rgx = new Regex(pattern, RegexOptions.IgnoreCase);

            if (rgx.IsMatch(RawInput) == true)
            {
                try
                {
                    IpAddress Address = new IpAddress(RawInput);
                    BinaryIpAddressTextBox.Text = Address.ToBinaryString();
                }
                catch (Exception)
                {

                    BinaryIpAddressTextBox.Text = "Invalid Address";
                }
            }
            else
            {
                BinaryIpAddressTextBox.Text = "";
            }
        }
开发者ID:Wamadahama,项目名称:Subnetting-Calculator,代码行数:27,代码来源:AddressToBinary.xaml.cs


示例14: TimeLimit_KeyUp

 private void TimeLimit_KeyUp(object sender, KeyEventArgs e)
 {
     if(e.Key == Key.Enter)
     {
         TimeLimit_LostFocus(null, null);
     }
 }
开发者ID:Hathor86,项目名称:MMBizHawkTool,代码行数:7,代码来源:ClockPanel.xaml.cs


示例15: OnlyNumbersAndCommas

 public static void OnlyNumbersAndCommas(KeyEventArgs e, TextBox tb)
 {
     if (e.Key != Key.Decimal && e.Key != Key.OemComma && (e.Key < Key.D0 || e.Key > Key.D9) && (e.Key < Key.NumPad0 || e.Key > Key.NumPad9))
     {
         e.Handled = true;
     }
 }
开发者ID:pavlove,项目名称:DailyClient,代码行数:7,代码来源:Validation.cs


示例16: panel_KeyUp

		void panel_KeyUp(object sender, KeyEventArgs e)
		{
			if (e.Key == Key.Insert) {
				AddNewWatch();
				e.Handled = true;
			}
		}
开发者ID:hpsa,项目名称:SharpDevelop,代码行数:7,代码来源:WatchPad.cs


示例17: Alphanumeric

 public static void Alphanumeric(KeyEventArgs e, TextBox tb)
 {
     if ((e.Key < Key.D0 || e.Key > Key.D9) && ((e.Key < Key.NumPad0) || (e.Key > Key.NumPad9)) && ((e.Key < Key.A) || (e.Key > Key.Z)) && (e.Key != Key.OemMinus))
     {
         e.Handled = true;
     }
 }
开发者ID:pavlove,项目名称:DailyClient,代码行数:7,代码来源:Validation.cs


示例18: watchList_KeyUp

		void watchList_KeyUp(object sender, KeyEventArgs e)
		{
			if (e.Key == Key.Delete) {
				RemoveWatchCommand cmd = new RemoveWatchCommand { Owner = this };
				cmd.Run();
			}
		}
开发者ID:hpsa,项目名称:SharpDevelop,代码行数:7,代码来源:WatchPad.cs


示例19: textBoxAcc_KeyDown

        private void textBoxAcc_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {

            }
        }
开发者ID:masoudrk,项目名称:Cad2D,代码行数:7,代码来源:Page_Hsc_X.xaml.cs


示例20: TaskEditorView_OnPreviewKeyDown

 private void TaskEditorView_OnPreviewKeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter && DataContext is TaskEditorViewModel && (DataContext as TaskEditorViewModel).AddTaskCommand.CanExecute(""))
     {
         (DataContext as TaskEditorViewModel).AddTaskCommand.Execute("");
     }
 }
开发者ID:jgera,项目名称:SambaPOS-3,代码行数:7,代码来源:TaskEditorView.xaml.cs



注:本文中的System.Windows.Input.KeyEventArgs类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Input.KeyGesture类代码示例发布时间:2022-05-26
下一篇:
C# Input.InputEventArgs类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap