如何在每行"Visual Studio 2008"之后添加数字? [英] how to add numbers after each line "visual studio 2008"
本文介绍了如何在每行"Visual Studio 2008"之后添加数字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在设计一个记事本应用程序,我需要一些帮助,我需要一些帮助,因此当我按键盘上的Enter/回车键换一行时,它会显示数字,例如
1 . a
2. b <3>. c 4. d 5. e
等....
问候
Aaron
解决方案
嗨aaron
我认为您可以使用"SendKeys.SendWait" &覆盖WndProc()并重新注册Globe热键输入/返回".在应用程序中执行所需的操作.
<身体> 导入System.Diagnostics 导入System.Runtime.InteropServices 导入System.Windows.Forms 公共类Form1 < DllImport(" User32.dll") > _ 公共共享功能SetForegroundWindow(ByVal hWnd As IntPtr)为布尔 结束功能
Const WM_Rbutton As Integer =& H204
受保护的重载覆盖子WndProc(作为消息的ByRef m)
如果m.Msg = WM_Rbutton然后MyBase.WndProc(m)
结束子公用SubsendKeysTest() Dim myProcess As Process = Process.开始("c:\ windows \ system32 \ notepad.exe") SetForegroundWindow(myProcess.Handle) 如果是myProcess.Responding然后 SendKeys.SendWait("1.a"& vbCrLf) 其他 myProcess.Kill() 结束如果是 结束Sub 私人SubButton2_Click(ByVal发送者为System.Object,ByVal e为System.EventArgs)处理Button2.单击 Me.sendKeysTest() 结束Sub 结束类
Hi i have a notepad application i am designing and i need some help i want something so when i press enter/return on keyboard for a new line it shows the number so for example
1. a
2. b
3. c
4. d
5. e
etc....
Regards
Aaron解决方案Hi aaron
I think you could use the " SendKeys.SendWait" & Overrides WndProc() and regedit a Globe hotkey "enter/return" to perform what you want in your application.
Imports System.Diagnostics Imports System.Runtime.InteropServices Imports System.Windows.Forms Public Class Form1 <DllImport("User32.dll")> _ Public Shared Function SetForegroundWindow(ByVal hWnd As IntPtr) As Boolean End Function
Const WM_Rbutton As Integer = &H204
Protected Overloads Overrides Sub WndProc(ByRef m As Message)
If m.Msg = WM_Rbutton Then
MessageBox.Show("RIGHT key")
End IfMyBase.WndProc(m)
End SubPublic Sub sendKeysTest() Dim myProcess As Process = Process.Start("c:\windows\system32\notepad.exe") SetForegroundWindow(myProcess.Handle) If myProcess.Responding Then SendKeys.SendWait("1.a" & vbCrLf) Else myProcess.Kill() End If End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Me.sendKeysTest() End Sub End Class
这篇关于如何在每行"Visual Studio 2008"之后添加数字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文