主题:TextBox应该能设置“是否自动换行”吧?我怎么找不到
singlion
[专家分:690] 发布于 2008-08-04 14:36:00
难道像VarPtr似的,不公开?
我说的自动换行不是Mutiline属性,而是像记事本那样:不遇到回车不换行,遇到回车才换行。而当Mutiline属性为False时,有回车也不换行
我尝试这种方法:
Private Sub Wrape_Click()
Wrape.Checked = Not Wrape.Checked
Text1.ScrollBars = IIf(Wrape.Checked, 2, 3)
End Sub
但是ScrollBars属性是只读的
最后更新于:2008-08-04 14:42:00
回复列表 (共7个回复)
沙发
singlion [专家分:690] 发布于 2008-08-04 15:19:00
算了,在网上找到这么一段话:
However, ES_MULTILINE is one of those styles which can't be changed after the control has been created. To change it dynamically, you would need to destroy the control and create a new one with the ES_MULTILINE style set when you call Create().
这样做太麻烦了
还不如直接用俩文本框。
板凳
singlion [专家分:690] 发布于 2008-08-04 15:35:00
ok,解决了
Private Sub Wrape_Click()
Wrape.Checked = Not Wrape.Checked
Text1.Visible = Wrape.Checked
Text2.Visible = Not Text1.Visible
If Text2.Visible Then
Text2.SelStart = Text1.SelStart
Text2.SelLength = Text1.SelLength
Else
Text1.SelStart = Text2.SelStart
Text1.SelLength = Text2.SelLength
End If
End Sub
3 楼
tanchuhan [专家分:15140] 发布于 2008-08-04 16:36:00
可以事先设定好,但不能运行时改变
MultiLine = True
ScroolBars = 2 - Vertical
4 楼
guoyong_cy [专家分:3050] 发布于 2008-08-06 20:16:00
[quote]可以事先设定好,但不能运行时改变
MultiLine = True
ScroolBars = 2 - Vertical[/quote]??
5 楼
tanchuhan [专家分:15140] 发布于 2008-08-06 21:09:00
[quote][quote]可以事先设定好,但不能运行时改变
MultiLine = True
ScroolBars = 2 - Vertical[/quote]??
[/quote]
??
6 楼
guoyong_cy [专家分:3050] 发布于 2008-08-06 21:42:00
ScroolBars = 1
不过还不是楼主最想要的!
7 楼
tanchuhan [专家分:15140] 发布于 2008-08-06 21:49:00
哦,原来我看错楼主问的了。
呵呵,这个没办法了,我用SPY++追过的,Window自带那个记事本切换自动换行,也是通过重新创建窗口的方法来实现的。
我来回复