[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

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

  1. Wsh.sleep 1*1000
  2. strAgentName = "Merlin"
  3. strAgentPath = "c:\windows\msagent\chars\" & strAgentName & ".acs"
  4. ScriptComplete=0
  5. Set objAgent = WScript.CreateObject("Agent.Control.2","agent_")
  6. objAgent.Connected = True
  7. objAgent.Characters.Load strAgentName, strAgentPath
  8. objCharacter.MoveTo 100, 700
  9. objCharacter.Show
  10. With bln
  11. .backcolor=RGB(255,0,0)
  12. .fontsize=20
  13. .forecolor=vbRed
  14. .fontname="华文楷体"
  15. .visible=False
  16. .style=3
  17. .fontunderline=True
  18. .numberoflines=10
  19. End With
  20. wsh.sleep 1000
  21. objcharacter.speak "测试123!"
复制代码
为什么不能设置balloon对象的backcolor和forecolor,这里老是提示参数设置错误。
而且balloon其他一些布尔型的属性数据也不能设置,如fontbold,fontunderline。各位大侠能否帮忙看看,到底怎么回事?谢谢!

backcolor和forecolor都是只读属性。
命令行参考:hh.exe ntcmds.chm::/ntcmds.htm
求助者请拿出诚心,别人才愿意奉献热心!
把查看手册形成条件反射!

TOP

谢了,看来有balloon下的那几个属性出800A01C2错误都是这个原因。MSDN上也没说明白是ReadOnly,那上面说法很容易让人产生误会。

TOP

发现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.

TOP

返回列表