Board logo

标题: [问题求助] VBS为什么不能设置balloon对象的backcolor和forecolor? [打印本页]

作者: killme2008    时间: 2012-5-17 09:27     标题: 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。各位大侠能否帮忙看看,到底怎么回事?谢谢!
作者: zqz0012005    时间: 2012-5-17 14:30

backcolor和forecolor都是只读属性。
作者: killme2008    时间: 2012-5-17 15:39

谢了,看来有balloon下的那几个属性出800A01C2错误都是这个原因。MSDN上也没说明白是ReadOnly,那上面说法很容易让人产生误会。
作者: killme2008    时间: 2012-5-18 08:53

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




欢迎光临 批处理之家 (http://bbs.bathome.net/) Powered by Discuz! 7.2