计划1
Dim frmCodeEditor
As system.Windows.Forms.Form = system.Windows.Forms.Form.ActiveForm
If frmCodeEditor
Is Nothing Then Return
'CurrentTable.Current("第一列")
= frmCodeEditor.Name
If
frmCodeEditor.Name <> "Class197" And frmCodeEditor.Name
<> "Class260" Then Return
If
frmCodeEditor.Controls("BtnNotepadEdit") IsNot Nothing Then Return
Dim tbtn As object
If
frmCodeEditor.name = "Class197" Then
tbtn = frmCodeEditor.controls("Button5")
Else
tbtn =
frmCodeEditor.controls("Button1")
End If
Dim BtnNotepadEdit
As New system.Windows.Forms.Button
With
BtnNotepadEdit
.Name = "BtnNotepadEdit"
.Anchor =
system.windows.Forms.AnchorStyles.Left Or system.windows.Forms.AnchorStyles.Bottom
.Top = tbtn.Top
.Left = 300
.Size = tbtn.Size
.Text = "NotePad++"
AddHandler .Click,AddressOf
NotepadEdit_Click
End With
frmCodeEditor.Controls.Add(BtnNotepadEdit)
自定义函数
NodePadEdit
'调用Notepad++
'Dim
CodeRichTextBox As
System.Windows.Forms.RichTextBox
'Dim frm = args(0)
'If frm.name =
"Class197" Then
'CodeRichTextBox =
frm.Controls("SplitContainer1").Panel1.Controls("MyCodeEditor21").Controls("SplitContainer1").Panel1.Controls("SplitContainer2").panel1.controls("Editor")
'Else
'CodeRichTextBox =
frm.Controls("MyCodeEditor1").Controls("SplitContainer1").Panel1.Controls("SplitContainer2").panel1.controls("Editor")
'End If
'
Dim
CodeRichTextBox As
System.Windows.Forms.RichTextBox
Dim frm =
System.windows.Forms.Form.activeform
If frm IsNot
Nothing AndAlso frm.name = "Class260" Then
'msgbox(frm.text)
If frm.text = "命令窗口" Then
CodeRichTextBox =
frm.Controls("SplitContainer1").Panel1.Controls("MyCodeEditor21").Controls("SplitContainer1").Panel1.Controls("SplitContainer2").panel1.controls("Editor")
Else
CodeRichTextBox =
frm.Controls("MyCodeEditor1").Controls("SplitContainer1").Panel1.Controls("SplitContainer2").panel1.controls("Editor")
End If
End If
FileSys.WriteAllText(ProjectPath
& "Temp\Code.Fox",CodeRichTextBox.Text,False)
CodeRichTextBox.SelectAll
Dim Proc As New
Process
Proc.WaitForClose
= True
'Proc.File =
"notepad"
Proc.File =
ProjectPath & "Temp\notepad++"
Proc.Arguments =
ProjectPath & "Temp\Code.Fox"
Proc.Start
Dim CodeStr As
String = FileSys.ReadAllText(ProjectPath & "Temp\Code.Fox")
If CodeStr =
CodeRichTextBox.Text Then Return Nothing
CodeRichTextBox.Text
= CodeStr
全局代码
Default
'启动NotePad++
Public Sub
NotepadEdit_Click(ByVal sender As Object, ByVal e As EventArgs)
Functions.Execute("NodePadEdit",
sender.findform)
End Sub