Private Sub Command1_Click()
  If MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row, 2) <> "" And IsNull(MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row, 2)) = False Then '该表格有数据
     With MSChart1
        .chartType = VtChChartType2dPie
        .ColumnCount = 2
        .RowCount = 1
        Dim XXX As Double
        XXX = Val(MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row, 2))
        .TitleText = "饼图示例 完成百分比"
        .Column = 1
        .Row = 1
        .Data = XXX
        .ColumnLabel = "完成百分比" & Str(XXX) & "%"
        .Column = 2
        .Row = 1
        .Data = 100 - XXX
        .ColumnLabel = "剩余百分比" & Str(100 - XXX) & "%"
     End With
  
  
'     With MSChart1
'        .ChartType = VtChChartType2dPie
'        .ColumnCount = 2
'        .RowCount = 1
'        Dim XXX As Double
'        XXX = Val(MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row, 2))
'        .TitleText = "饼图示例 完成百分比"
'        .Column = 1
'        .Row = 1
'        .Data = XXX
'        .ColumnLabel = "完成百分比" & Str(XXX) & "%"
'        .Column = 2
'        .Row = 1
'        .Data = 100 - XXX
'        .ColumnLabel = "剩余百分比" & Str(100 - XXX) & "%"
'     End With
  
  End IfEnd Sub

解决方案 »

  1.   

    对不起,恕我直言:lihonggen0(用VB) 的方法根本就是错误的!
    -- “MSHFlexGrid1”从何来?
      

  2.   

    faint,MSHFlexFrid1从何来并不重要,它只是提供数据,     With MSChart1
            .chartType = VtChChartType2dPie
            .ColumnCount = 2
            .RowCount = 1
            Dim XXX As Double
            XXX = Val(MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row, 2))
            .TitleText = "饼图示例 完成百分比"
            .Column = 1
            .Row = 1
            .Data = XXX
            .ColumnLabel = "完成百分比" & Str(XXX) & "%"
            .Column = 2
            .Row = 1
            .Data = 100 - XXX
            .ColumnLabel = "剩余百分比" & Str(100 - XXX) & "%"
         End With
      才是显示Mschart比例的部分你可以把XXX=50而不是XXX = Val(MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row, 2))
      

  3.   

    我也是在找它的这个属性,因为我是将Recordset绑定到Mschart上的,手工处理太麻烦,我查过以前的贴子,好像有这个属性,但没有说清楚!谁能告知,一定给分!