以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助]代码编辑器的改造问题 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=121722) |
-- 作者:ericsky -- 发布时间:2018/7/12 10:21:00 -- [求助]代码编辑器的改造问题 照着大红袍老师的帖子对代码编辑器做了改造,帖子链接如下: 昨日升级到最新版本,里面有些代码执行不了,应该是代码编辑器里的控件名改变了,比如: \'调用Notepad++ Dim CodeRichTextBox As 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 frmCodeEditor As Windows.Forms.Form = Windows.Forms.Form.ActiveForm If frmCodeEditor Is Nothing Then Return End If If frmCodeEditor.Name <> "Class197" And frmCodeEditor.Name <> "Class260" Then Return End If Dim tbtn If frmCodeEditor.name = "Class197" Then tbtn = frmCodeEditor.controls("Button5") Else tbtn = frmCodeEditor.controls("btnSQL") End If 也定义不到tbtn。 请帮忙指点,谢谢!
[此贴子已经被作者于2018/7/12 10:24:54编辑过]
|
-- 作者:有点甜 -- 发布时间:2018/7/12 10:27:00 -- 测试代码
Dim frmCodeEditor As Windows.Forms.Form = Windows.Forms.Form.ActiveForm |
-- 作者:ericsky -- 发布时间:2018/7/12 11:09:00 -- 有点甜老师,只搜索到5个控件,其他的怎么搜索? |
-- 作者:有点甜 -- 发布时间:2018/7/12 11:39:00 -- 比如
Dim frmCodeEditor As Windows.Forms.Form = Windows.Forms.Form.ActiveForm |
-- 作者:ericsky -- 发布时间:2018/7/12 12:10:00 -- 搞定,谢谢! 其实窗口里面的控件都没变化,升级后代码编辑器的窗口名变成 "Class260"
|
-- 作者:shanshuizhujian -- 发布时间:2018/7/19 11:32:00 -- 命令窗口的是260,其他的是197.通用的好像不行了。 |
-- 作者:有点甜 -- 发布时间:2018/7/19 12:43:00 -- Windows.Forms.Form.ActiveForm的name属性,不就行了?
其余细节自己调整。 |
-- 作者:shanshuizhujian -- 发布时间:2018/7/27 9:11:00 -- 还是没明白 |
-- 作者:有点甜 -- 发布时间:2018/7/27 9:17:00 -- 以下是引用shanshuizhujian在2018/7/27 9:11:00的发言:
还是没明白
那你就把197改成260,现在所有的命令窗口,都改成了同一的class260了 |
-- 作者:shanshuizhujian -- 发布时间:2018/7/27 9:30:00 -- 改成260好像也不行啊,命令窗口的是这样的:CodeRichTextBox = frm.Controls("SplitContainer1").Panel1.Controls("MyCodeEditor21").Controls("SplitContainer1").Panel1.Controls("SplitContainer2").panel1.controls("Editor") 而代码编辑器的是这样的:CodeRichTextBox = frm.Controls("MyCodeEditor1").Controls("SplitContainer1").Panel1.Controls("SplitContainer2").panel1.controls("Editor") 原来一个是197和260,可以进行判断,现在都是260了,但是里面的没有修改,这个怎么判断?
|