我想请教一下就是怎么样把mschart控件程序中所显示出来的多列设置成不同的颜色啊?
比如说其中有多列时,那怎么样搞啊?
当我设置了两列的颜色的时候:
MSCH.Plot.SeriesCollection(1).DataPoints(-1).Brush.FillColor.Set 0, 255, 0
MSCH.Plot.SeriesCollection(1).DataPoints(-1).Brush.FillColor.Set 0, 255, 255
怎么都显示最后一列的颜色MSCH.Plot.SeriesCollection(1).DataPoints(-1).Brush.FillColor.Set 0, 255, 255啊??有什么办法可以让他显示不一样的颜色啊??代码如下:
MSCH.TitleText = "—————" & "(%)"
MSCH.Row = 1
MSCH.Data = agree5
'设置成所要颜色
MSCH.Plot.SeriesCollection(1).DataPoints(-1).Brush.FillColor.Set 0, 255, 0
MSCH.Row = 2
MSCH.Data = UnAgree5
'设置成所要颜色
MSCH.Plot.SeriesCollection(1).DataPoints(-1).Brush.FillColor.Set 0, 255, 255
MSCH.Row = 3
MSCH.Data = NonUser5
'设置成所要颜色
'MSCH.Plot.SeriesCollection(3).DataPoints(-1).Brush.FillColor.Set 255, 255, 0
MSCH.Row = 4
MSCH.Data = UnDo5
'设置成所要颜色
'MSCH.Plot.SeriesCollection(4).DataPoints(-1).Brush.FillColor.Set 255, 0, 0
' 将这些函数粘贴到 Form 或 Code
' 模块的Declarations部分中。
Public Function RedFromRGB(ByVal rgb As Long) _
As Integer
' &HFF 后的“&”符号将数字强制
'为长整型,防止 Visual Basic
'将其视为负值。逻辑 And 操作用
'来返回位值。
RedFromRGB = &HFF& And rgb
End Function
Public Function GreenFromRGB(ByVal rgb As Long) _
As Integer
' And 操作的结果是除以 256 ,
' 以便返回中部字节的值。
' 注意整型除数的用法。
GreenFromRGB = (&HFF00& And rgb) \ 256
End Function
Public Function BlueFromRGB(ByVal rgb As Long) _
As Integer
' 此函数和上面的 GreenFromRGB 函数
' 功能相似,除了不需要使用“&”符号。
' 数字已经是长整型了。结果除以 65536
' 以便得到最高的几位字节。
BlueFromRGB = (&HFF0000 And rgb) \ 65536
End Function
比如说其中有多列时,那怎么样搞啊?
当我设置了两列的颜色的时候:
MSCH.Plot.SeriesCollection(1).DataPoints(-1).Brush.FillColor.Set 0, 255, 0
MSCH.Plot.SeriesCollection(1).DataPoints(-1).Brush.FillColor.Set 0, 255, 255
怎么都显示最后一列的颜色MSCH.Plot.SeriesCollection(1).DataPoints(-1).Brush.FillColor.Set 0, 255, 255啊??有什么办法可以让他显示不一样的颜色啊??代码如下:
MSCH.TitleText = "—————" & "(%)"
MSCH.Row = 1
MSCH.Data = agree5
'设置成所要颜色
MSCH.Plot.SeriesCollection(1).DataPoints(-1).Brush.FillColor.Set 0, 255, 0
MSCH.Row = 2
MSCH.Data = UnAgree5
'设置成所要颜色
MSCH.Plot.SeriesCollection(1).DataPoints(-1).Brush.FillColor.Set 0, 255, 255
MSCH.Row = 3
MSCH.Data = NonUser5
'设置成所要颜色
'MSCH.Plot.SeriesCollection(3).DataPoints(-1).Brush.FillColor.Set 255, 255, 0
MSCH.Row = 4
MSCH.Data = UnDo5
'设置成所要颜色
'MSCH.Plot.SeriesCollection(4).DataPoints(-1).Brush.FillColor.Set 255, 0, 0
' 将这些函数粘贴到 Form 或 Code
' 模块的Declarations部分中。
Public Function RedFromRGB(ByVal rgb As Long) _
As Integer
' &HFF 后的“&”符号将数字强制
'为长整型,防止 Visual Basic
'将其视为负值。逻辑 And 操作用
'来返回位值。
RedFromRGB = &HFF& And rgb
End Function
Public Function GreenFromRGB(ByVal rgb As Long) _
As Integer
' And 操作的结果是除以 256 ,
' 以便返回中部字节的值。
' 注意整型除数的用法。
GreenFromRGB = (&HFF00& And rgb) \ 256
End Function
Public Function BlueFromRGB(ByVal rgb As Long) _
As Integer
' 此函数和上面的 GreenFromRGB 函数
' 功能相似,除了不需要使用“&”符号。
' 数字已经是长整型了。结果除以 65536
' 以便得到最高的几位字节。
BlueFromRGB = (&HFF0000 And rgb) \ 65536
End Function
在property page里的chart\series in rows 谢谢!!结贴