如何在VB.NET中编写退格和空格代码 [英] How to write code for backspace and space in VB.NET

查看:481
本文介绍了如何在VB.NET中编写退格和空格代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用图像编写虚拟键盘,当我按下按钮时它会显示图像但是我无法编码空间和退格...



I am programming virtual keyboard with images, when I press the button it will display image but am not able to code space and backspace...

Private Sub Button26_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button26.Click
Dim myDir As String = "C:\Users\ASUBUSU\Desktop\keyboard\java pgm\"
Dim img As Image = Image.FromFile(myDir &"ya.png")
Dim orgData = Clipboard.GetDataObject
Clipboard.SetImage(img)
Me.RichTextBox1.Paste()

Clipboard.SetDataObject(orgData)



End Sub

如何在按钮点击中编写空格和退格代码



谢谢...



我尝试了什么:




End Sub
How to write code for space and backspace in button click

Thanks...

What I have tried:

If e.KeyChar = Convert.ToChar(Keys.Back) Then

推荐答案

声明



私人Kbd为新的Microsoft.VisualBasic.Devices.Keyboard







以及你想寄回空间的地方插入这条线





Kbd.SendKeys(Chr(Keys.Back))
declare

Private Kbd as new Microsoft.VisualBasic.Devices.Keyboard



and where you want to send back space insert this line there


Kbd.SendKeys(Chr(Keys.Back))


您可以使用SendKeys.Send()方法发送退格键和空格键


或者你可以使用PostMessage刺激按键。

告诉你要发送密钥的位置
You can use SendKeys.Send() method to send backspace and space keys

Or else you can use PostMessage to stimulate keypress.
Tell where you want to send the keys


这篇关于如何在VB.NET中编写退格和空格代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆