9、SetBackgroundEffect函数
[入库:2005年8月18日] [更新:2007年3月25日]
该函数用来设置图表的特殊效果。
sub setbackgroundeffect(byval ixlchartfilleffect as xlchartfilleffect)
on error goto herror
'--- 将图表设置为三维
oexcelchart.wallsandgridlines2d = false
'--- 背景墙
with oexcelchart.walls
.border.weight = xlthin
.border.linestyle = xlcontinuous
'--- 特效代码是否在范围之内
if (ixlchartfilleffect > 0 and ixlchartfilleffect < 24) then
.fill.presetgradient style:=1, variant:=1, _
presetgradienttype:=ixlchartfilleffect
else
.fill.onecolorgradient style:=1, variant:=1, degree:=0.231372549019608
.fill.forecolor.schemecolor = 15
end if
end with
'--- 底面
with oexcelchart.floor
.border.weight = xlhairline
.border.linestyle = xlautomatic
'--- 特效代码是否在范围之内
if (ixlchartfilleffect > 0 and ixlchartfilleffect < 24) then
.fill.presetgradient style:=1, variant:=1, _
presetgradienttype:=ixlchartfilleffect
else
.fill.onecolorgradient style:=1, variant:=1, degree:=0.231372549019608
.fill.forecolor.schemecolor = 15
end if
end with
exit sub
herror:
app.logevent err.description, vblogeventtypeerror
err.raise err.number, err.source, err.description
end sub
|
特效只对三维图表有效。chart对象包含walls(背景墙)和floor(三维图表的底面)两个对象,其中又包含着填充的边界、过渡等细节属性。如有必要的话可以显露并使用这些细节属性。
我们已经提供了实现特殊效果的基本机制,在本文的第一部分也可以看到图表特效的一些例子。对特殊效果来说最重要的一个对象是fill对象,包括walls和floor对象在内的许多构造用户界面的excel对象都包含fill对象。presetgradient()和onecolorgradient()这两个方法的功能分别是用excel中预定义的过渡效果或颜色填充容器。
本文关键:9、SetBackgroundEffect函数
本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)