找回密码
 注册
搜索
[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
查看: 18187|回复: 3

[问题求助] VBS为什么不能设置balloon对象的backcolor和forecolor?

[复制链接]
发表于 2012-5-17 09:27:20 | 显示全部楼层 |阅读模式
  1. Wsh.sleep 1*1000
  2.         strAgentName = "Merlin"
  3.         strAgentPath = "c:\windows\msagent\chars" & strAgentName & ".acs"
  4.         ScriptComplete=0
  5.        
  6.         Set objAgent = WScript.CreateObject("Agent.Control.2","agent_")
  7.         objAgent.Connected = True
  8.         objAgent.Characters.Load strAgentName, strAgentPath
  9.         objCharacter.MoveTo 100, 700
  10.         objCharacter.Show
  11.         With bln
  12.                 .backcolor=RGB(255,0,0)
  13.                 .fontsize=20
  14.                 .forecolor=vbRed
  15.                 .fontname="华文楷体"
  16.                 .visible=False
  17.                 .style=3
  18.                 .fontunderline=True
  19.                 .numberoflines=10
  20.         End With
  21.         wsh.sleep 1000
  22.         objcharacter.speak "测试123!"
复制代码
为什么不能设置balloon对象的backcolor和forecolor,这里老是提示参数设置错误。
而且balloon其他一些布尔型的属性数据也不能设置,如fontbold,fontunderline。各位大侠能否帮忙看看,到底怎么回事?谢谢!
发表于 2012-5-17 14:30:16 | 显示全部楼层
backcolor和forecolor都是只读属性。
 楼主| 发表于 2012-5-17 15:39:31 | 显示全部楼层
谢了,看来有balloon下的那几个属性出800A01C2错误都是这个原因。MSDN上也没说明白是ReadOnly,那上面说法很容易让人产生误会。
 楼主| 发表于 2012-5-18 08:53:15 | 显示全部楼层
发现MSDN上说法有些问题,如balloon.style参数如下解释,按照下面解释numberoflines在style为0时是可以设置的。但是实际当style设置为0后,numberoflines依然不能设置,仍然出现800A01C2错误。
http://msdn.microsoft.com/en-us/library/ms697265(v=vs.85)

When the balloon-on style bit is set to 1, the word balloon appears when a Speak or Think method is used, unless the user overrides this setting in the Microsoft Agent property sheet. When set to 0, a balloon does not appear.

When the size-to-text style bit is set to 1, the word balloon automatically sizes the height of the balloon to the current size of the text for the Speak or Think statement. When set to 0, the balloon's height is based on the NumberOfLines property setting. If this style bit is set to 1 and you attempt to set the NumberOfLines property, Agent raises an error.
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|批处理之家 ( 渝ICP备10000708号 )

GMT+8, 2026-3-17 12:52 , Processed in 0.017458 second(s), 8 queries , File On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表