以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]可以设置文件框中每段文字的颜色不一样吗?  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=131349)

--  作者:youngerlsy123456
--  发布时间:2019/2/23 22:53:00
--  [求助]可以设置文件框中每段文字的颜色不一样吗?
给窗口的一个文本框赋值为"苹果:5元/斤",想让"苹果:"是蓝色,"5元/斤"是红色.
有代码可以实现吗?
我现在写的代码只能写成:
            e.Form.Controls("shuiguojiagexianshi").value = e.Form.Controls("shuiguojiagexianshi").value & "$" & e.Form.Controls("shuiguo").value & ":"
            
            If e.Form.Controls("pingguo").value IsNot Nothing Then
                e.Form.Controls("shuiguojiagexianshi").value = e.Form.Controls("shuiguojiagexianshi").value & e.Form.Controls("pingguo").value  & e.Form.Controls("pingguojiage").value & " "
            End If
            If e.Form.Controls("xueli").value IsNot Nothing Then
                e.Form.Controls("shuiguojiagexianshi").value = e.Form.Controls("shuiguojiagexianshi").value & e.Form.Controls("xueli").value  & e.Form.Controls("xuelijiage").value & " "
            End If
            ........
但当文字量大的时候,看起来太乱,眼比较花.


--  作者:有点甜
--  发布时间:2019/2/24 13:13:00
--  

如果仅仅是显示内容,可以用webbrowser显示,如

 

Dim web = e.form.controls("webbrowser1").basecontrol
web.documenttext = "<html><body><label style=\'color:red\'>123</label><label>456</label></body></html>"