首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

支持多曲线的曲线控件

2012-01-08 
求一个支持多曲线的曲线控件求一 个比较好的。能同时显示多条曲线的控件,谢谢[解决办法]你最好用工具画好,

求一个支持多曲线的曲线控件
求一 个比较好的。能同时显示多条曲线的控件,谢谢

[解决办法]
你最好用工具画好,然后再导入
[解决办法]
(声明:魏滔序原创,转贴请注明出处。)
早就想亲自DIY一个类似Windwos任务管理器中的CPU和内存的曲线图,因时间关系直到现在才如愿以偿。虽然做的粗糙点,但勉强说的过去。
功能:可以设置是否显示值刻度、网格、曲线、时间刻度等,可以定义背景颜色、网格颜色、刻度颜色、曲线颜色等,可以设置网格大小、刻度间隔、曲线进展长度,最重要的是可以支持多曲线运行。

名称:Graph
VERSION 5.00
Begin VB.UserControl Graph 
AutoRedraw = -1 'True
BackColor = &H00000000&
ClientHeight = 1605
ClientLeft = 0
ClientTop = 0
ClientWidth = 2880
ForeColor = &H8000000B&
HitBehavior = 0 '无
ScaleHeight = 1605
ScaleWidth = 2880
End
Attribute VB_Name = "Graph"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit

Private m_Coll() As Collection
Private m_Color() As OLE_COLOR
Private m_Time As Collection

Private m_MaxValue As Single
Private m_ScaleColor As OLE_COLOR
Private m_GridColor As OLE_COLOR
Private m_CellWidth As Single
Private m_CellHeight As Single
Private m_Spaced As Single
Private m_ValueScale As Single
Private m_TimeScale As Long

Private m_ShowGraph As Boolean
Private m_ShowGrid As Boolean
Private m_ShowValueScale As Boolean
Private m_ShowTimeScale As Boolean


'背景颜色
Public Property Get BackColor() As OLE_COLOR
BackColor = UserControl.BackColor
End Property
Public Property Let BackColor(ByVal Value As OLE_COLOR)
UserControl.BackColor = Value
Call AddValue
PropertyChanged "BackColor"
End Property

'数字颜色
Public Property Get ScaleColor() As OLE_COLOR
ScaleColor = m_ScaleColor
End Property
Public Property Let ScaleColor(ByVal Value As OLE_COLOR)
m_ScaleColor = Value
Call AddValue
PropertyChanged "ScaleColor"
End Property

'网格颜色
Public Property Get GridColor() As OLE_COLOR
GridColor = m_GridColor
End Property
Public Property Let GridColor(ByVal Value As OLE_COLOR)
m_GridColor = Value
Call AddValue
PropertyChanged "GridColor"
End Property

'曲线是否可见
Public Property Get ShowGraph() As Boolean
ShowGraph = m_ShowGraph
End Property
Public Property Let ShowGraph(ByVal Value As Boolean)
m_ShowGraph = Value
Call AddValue
PropertyChanged "ShowGraph"
End Property

'网格是否可见
Public Property Get ShowGrid() As Boolean
ShowGrid = m_ShowGrid
End Property
Public Property Let ShowGrid(ByVal Value As Boolean)
m_ShowGrid = Value
Call AddValue
PropertyChanged "ShowGrid"
End Property

'值刻度是否可见
Public Property Get ShowValueScale() As Boolean
ShowValueScale = m_ShowValueScale
End Property
Public Property Let ShowValueScale(ByVal Value As Boolean)
m_ShowValueScale = Value
Call AddValue
PropertyChanged "ShowValueScale"
End Property

'时间刻度是否可见
Public Property Get ShowTimeScale() As Boolean
ShowTimeScale = m_ShowTimeScale
End Property
Public Property Let ShowTimeScale(ByVal Value As Boolean)
m_ShowTimeScale = Value
Call AddValue
PropertyChanged "ShowTimeScale"
End Property

'单格宽度
Public Property Get CellWidth() As Single
CellWidth = m_CellWidth
End Property
Public Property Let CellWidth(ByVal Value As Single)
m_CellWidth = Value
Call AddValue
PropertyChanged "CellWidth"
End Property

'单格宽度
Public Property Get CellHeight() As Single


CellHeight = m_CellHeight
End Property
Public Property Let CellHeight(ByVal Value As Single)
m_CellHeight = Value
Call AddValue
PropertyChanged "CellHeight"
End Property

'值间隔
Public Property Get Spaced() As Long
Spaced = m_Spaced
End Property
Public Property Let Spaced(ByVal Value As Long)
m_Spaced = Value
Call AddValue
PropertyChanged "Spaced"
End Property

'值刻度
Public Property Get ValueScale() As Long
ValueScale = m_ValueScale
End Property
Public Property Let ValueScale(ByVal Value As Long)
m_ValueScale = Value
Call AddValue
PropertyChanged "ValueScale"
End Property

'时间刻度
Public Property Get TimeScale() As Long
TimeScale = m_TimeScale
End Property
Public Property Let TimeScale(ByVal Value As Long)
m_TimeScale = Value
PropertyChanged "TimeScale"
End Property

'最大比例
Public Property Get MaxValue() As Single
MaxValue = m_MaxValue
End Property
Public Property Let MaxValue(ByVal Value As Single)
m_MaxValue = Value
Call AddValue
PropertyChanged "MaxValue"
End Property

'曲线个数
Public Property Get GraphCount() As Long
On Error Resume Next
GraphCount = UBound(m_Coll) + 1
End Property

Private Sub UserControl_Resize()
Call AddValue
End Sub
[解决办法]
还是用微软的MsChart控件吧
[解决办法]
TChart不错

热点排行