回复 5楼tianyake的帖子
不好意思,Spread COM版不支持图表功能,Spread 其他平台产品都提供丰富图表功能。
VB6.0 绘图方法我也不太了解,在 Spread 使用方面,起作用的是这个事件:
- Private Sub spread_DrawItem(ByVal Col As Long, ByVal row As Long, ByVal hDC As stdole.OLE_HANDLE, ByVal left As Long, ByVal top As Long, ByVal right As Long, ByVal Bottom As Long, ByVal style As Long)
- Dim s As Long
- Dim hBrush As Long
- Dim Rec As RECT
- Dim xMargin As Long
- Dim yMargin As Long
-
- ' Reduce the cell rectangle by 10 percent on each side.
- Rec.left = left / Screen.TwipsPerPixelX
- Rec.right = right / Screen.TwipsPerPixelX
- Rec.top = top / Screen.TwipsPerPixelY
- Rec.Bottom = Bottom / Screen.TwipsPerPixelY
- ' Reduce the rectangle by 20 percent.
- xMargin = (Rec.right - Rec.left) / 10
- yMargin = (Rec.Bottom - Rec.top) / 10
- Rec.left = Rec.left + xMargin
- Rec.right = Rec.right - xMargin
- Rec.top = Rec.top + yMargin
- Rec.Bottom = Rec.Bottom - yMargin
- ' Use Style parameter (.i.e TypeOwnerDrawStyle property of cell) to
- ' determine the figure to paint in the cell.
- If style = STYLE_ELLIPSE Then
- s = Ellipse(hDC, Rec.left, Rec.top, Rec.right, Rec.Bottom)
- ElseIf style = STYLE_RECTANGLE Then
- s = Rectangle(hDC, Rec.left, Rec.top, Rec.right, Rec.Bottom)
- ElseIf style = STYLE_ROUNDRECT Then
- s = RoundRect(hDC, Rec.left, Rec.top, Rec.right, Rec.Bottom, (Rec.left - Rec.right) / 3, (Rec.Bottom - Rec.top) / 3)
- ElseIf style = STYLE_FILLRECT Then
- hBrush = CreateSolidBrush(RGB(255, 0, 0))
- s = FillRect(hDC, Rec, hBrush)
- s = DeleteObject(hBrush)
- End If
-
- ' Also use the Text property of cell
- spread.Col = Col
- spread.row = row
- s = DrawText(hDC, spread.Text, Len(spread.Text), Rec, DT_CENTER + DT_VCENTER + DT_SINGLELINE)
- End Sub
复制代码 |