类似这个:
dim cont as string()
dim ls as WinForm.TextBox
ls = e.form.Controls("textbox1")
cont = ls.SelectedText.Split(Chr(13))
If e.Control = True AndAlso e.KeyCode = Keys.F11 Then
for each s as string in cont
dim ss as string
if cont(0).SubString(0,1)="'" then
if s=cont(0) then
ss= s.SubString(1) & vbcrlf
else
ss = s.SubString(2) & vbcrlf
end if
else
if s=cont(0) then
ss = "'" & s.SubString(0) & vbcrlf
else
ss = "'" & s.SubString(1) & vbcrlf
end if
end if
ls.SelectedText = ss
next
end if
说明:选中代码行后,同时按ctrl和f11,批量注释和反注释
[此贴子已经被作者于2010-6-26 22:31:43编辑过]