xchart.ctl
来自「多种图表的绘制及其运用」· CTL 代码 · 共 1,923 行 · 第 1/5 页
CTL
1,923 行
picToPrinterLegend.Print picDescription(intIdx).Tag
picToPrinterLegend.Line (sngXBox, sngY)-(sngXBox + sngWBox, sngY + sngWBox), picBox(intIdx).BackColor, BF
Next
Select Case uPrinterFit
Case prtFitStretched
sngXoff = Printer.ScaleWidth * Printer.ScaleX(.ScaleWidth, .ScaleMode, Printer.ScaleMode) / UserControl.ScaleWidth
Case Else
sngXoff = .ScaleWidth
End Select
picToPrinter.Width = picToPrinter.Width + sngXoff
picToPrinter.PaintPicture .Image, picToPrinter.Width - sngXoff, 0, sngXoff, sngH
End With
End If
End If
With picToPrinter
Select Case uPrinterFit
Case prtFitCentered
sngY = ((Printer.ScaleHeight - .ScaleHeight) / 2)
sngX = ((Printer.ScaleWidth - .ScaleWidth) / 2)
Case prtFitStretched, prtFitTopLeft
sngX = 0
sngY = 0
Case prtFitTopRight
sngX = Printer.ScaleWidth - .ScaleWidth
sngY = 0
Case prtFitBottomLeft
sngX = 0
sngY = Printer.ScaleHeight - .ScaleHeight
Case prtFitBottomRight
sngX = Printer.ScaleWidth - .ScaleWidth
sngY = Printer.ScaleHeight - .ScaleHeight
End Select
Printer.PaintPicture .Image, sngX, sngY, .ScaleWidth, .ScaleHeight
Printer.EndDoc
End With
If (bDisplayLegend = True) And (uLegendPrintMode = legPrintText) Then
Call PrintLegend
End If
Screen.MousePointer = vbDefault
End Sub
Public Property Get Selectable() As Boolean
Attribute Selectable.VB_Description = "Returns/sets a value that determines if a bar can be selected with the mouse."
Selectable = uSelectable
End Property
Public Property Let HotTracking(blnVal As Boolean)
If blnVal <> uHotTracking Then
uHotTracking = blnVal
DrawChart
PropertyChanged "HotTracking"
End If
End Property
Public Property Get HotTracking() As Boolean
Attribute HotTracking.VB_Description = "Returns/sets a value that determines if a bar becomes selected while moving over the mouse."
HotTracking = uHotTracking
End Property
Public Property Get LegendCaption() As String
LegendCaption = uLegendCaption
End Property
Public Property Let SelectedColumn(lngColumn As Long)
Dim oItem As ChartItem
On Error Resume Next
If lngColumn <> uSelectedColumn Then
uSelectedColumn = lngColumn
DrawChart
PropertyChanged "SelectedColumn"
If Err.Number Then
uSelectedColumn = -1
Else
If (uMeanOn = True) And (uSelectedColumn = cItems.Count - 1) Then
'do nothing in case of mean bar selected
Else
oItem = cItems(lngColumn + 1)
RaiseEvent ItemClick(oItem)
End If
End If
End If
End Property
Public Property Get SelectedColumn() As Long
Attribute SelectedColumn.VB_Description = "Returns/sets the number of selected bar."
SelectedColumn = uSelectedColumn
End Property
Public Property Let ChartTitle(stgVal As String)
If stgVal <> uChartTitle Then
uChartTitle = stgVal
DrawChart
PropertyChanged "ChartTitle"
End If
End Property
Public Property Get ChartTitle() As String
Attribute ChartTitle.VB_Description = "Determines the title of the chart."
ChartTitle = uChartTitle
End Property
Public Property Let MenuItems(stgVal As String)
uMenuItems = stgVal
FixMenu
PropertyChanged "MenuItems"
End Property
Public Property Let CustomMenuItems(stgVal As String)
uCustomMenuItems = stgVal
FixCustomMenu
PropertyChanged "CustomMenuItems"
End Property
Public Property Let InfoItems(stgVal As String)
uInfoItems = stgVal
PropertyChanged "InfoItems"
End Property
Public Property Get InfoItems() As String
Attribute InfoItems.VB_Description = "Determines the string values displayed when selection information is enabled (separated by |)."
InfoItems = uInfoItems
End Property
Public Property Get MenuItems() As String
Attribute MenuItems.VB_Description = "Determines the string values displayed when popup menu is enabled (separated by |)."
MenuItems = uMenuItems
End Property
Public Property Get CustomMenuItems() As String
CustomMenuItems = uCustomMenuItems
End Property
Public Property Let ChartSubTitle(stgVal As String)
If stgVal <> uChartSubTitle Then
uChartSubTitle = stgVal
DrawChart
PropertyChanged "ChartSubTitle"
End If
End Property
Public Property Get ChartSubTitle() As String
Attribute ChartSubTitle.VB_Description = "Determines the subtitle of the chart."
ChartSubTitle = uChartSubTitle
End Property
Public Property Let IntersectMajor(sngVal As Single)
If sngVal <> uIntersectMajor Then
uIntersectMajor = sngVal
DrawChart
PropertyChanged "IntersectMajor"
End If
End Property
Public Property Get IntersectMajor() As Single
Attribute IntersectMajor.VB_Description = "Determines the value which the major intersection line is displayed for."
IntersectMajor = uIntersectMajor
End Property
Public Property Let IntersectMinor(sngVal As Single)
If sngVal <> uIntersectMinor Then
uIntersectMinor = sngVal
DrawChart
PropertyChanged "IntersectMinor"
End If
End Property
Public Property Get IntersectMinor() As Single
Attribute IntersectMinor.VB_Description = "Determines the value which the minor intersection line is displayed for."
IntersectMinor = uIntersectMinor
End Property
Public Property Let AxisYOn(blnVal As Boolean)
Attribute AxisYOn.VB_Description = "Returns/sets the value that determines if the Y-axis items must be displayed."
If blnVal <> uAxisYOn Then
uAxisYOn = blnVal
DrawChart
PropertyChanged "AxisYOn"
End If
End Property
Public Property Get AxisYOn() As Boolean
AxisYOn = uAxisYOn
End Property
Public Property Let AxisXOn(blnVal As Boolean)
Attribute AxisXOn.VB_Description = "Returns/sets the value that determines if the X-axis items must be displayed."
If blnVal <> uAxisXOn Then
uAxisXOn = blnVal
DrawChart
PropertyChanged "AxisXOn"
End If
End Property
Public Property Get AxisXOn() As Boolean
AxisXOn = uAxisXOn
End Property
Public Property Let MaxY(dblMax As Double)
Attribute MaxY.VB_Description = "Returns/sets the maximum Y value."
If dblMax > uMinYValue Then
uMaxYValue = dblMax
DrawChart
PropertyChanged "MaxY"
End If
End Property
Public Property Let MinY(dblMin As Double)
Attribute MinY.VB_Description = "Returns/sets the minimum Y value."
If dblMin < uMaxYValue Then
uMinYValue = dblMin
DrawChart
PropertyChanged "MinY"
End If
End Property
Public Property Get MinY() As Double
MinY = uMinYValue
End Property
Public Property Get MaxY() As Double
MaxY = uMaxYValue
End Property
Public Property Let SelectionInformation(blnVal As Boolean)
Attribute SelectionInformation.VB_Description = "Determines if the information box about the selected bar must be visible or hidden."
If blnVal <> uDisplayDescript Then
uDisplayDescript = blnVal
DrawChart
PropertyChanged "SelectionInformation"
End If
End Property
Public Property Get SelectionInformation() As Boolean
SelectionInformation = uDisplayDescript
End Property
Public Property Let AxisLabelY(stgCaption As String)
Attribute AxisLabelY.VB_Description = "Returns/sets the Y-axis label."
If stgCaption <> uYAxisLabel Then
uYAxisLabel = stgCaption
DrawChart
PropertyChanged "AxisLabelY"
End If
End Property
Public Property Get AxisLabelY() As String
AxisLabelY = uYAxisLabel
End Property
Public Property Let AxisLabelX(stgCaption As String)
Attribute AxisLabelX.VB_Description = "Returns/sets the X-axis label."
If stgCaption <> uXAxisLabel Then
uXAxisLabel = stgCaption
DrawChart
PropertyChanged "AxisLabelX"
End If
End Property
Public Property Let AxisLabelXColor(lngVal As OLE_COLOR)
Attribute AxisLabelXColor.VB_Description = "Returns/sets the color used to display the X-axis label."
If lngVal <> uXAxisLabelColor Then
uXAxisLabelColor = lngVal
DrawChart
PropertyChanged "AxisLabelXColor"
End If
End Property
Public Property Let AxisLabelYColor(lngVal As OLE_COLOR)
Attribute AxisLabelYColor.VB_Description = "Returns/sets the color used to display the Y-axis label."
If lngVal <> uYAxisLabelColor Then
uYAxisLabelColor = lngVal
DrawChart
PropertyChanged "AxisLabelYColor"
End If
End Property
Public Property Let AxisItemsYColor(lngVal As OLE_COLOR)
Attribute AxisItemsYColor.VB_Description = "Returns/sets the color used to display the Y-axis items."
If lngVal <> uYAxisItemsColor Then
uYAxisItemsColor = lngVal
DrawChart
PropertyChanged "AxisItemsYColor"
End If
End Property
Public Property Let AxisItemsXColor(lngVal As OLE_COLOR)
Attribute AxisItemsXColor.VB_Description = "Returns/sets the color used to display the X-axis items."
If lngVal <> uXAxisItemsColor Then
uXAxisItemsColor = lngVal
DrawChart
PropertyChanged "AxisItemsXColor"
End If
End Property
Public Property Get AxisItemsYColor() As OLE_COLOR
AxisItemsYColor = uYAxisItemsColor
End Property
Public Property Get AxisItemsXColor() As OLE_COLOR
AxisItemsXColor = uXAxisItemsColor
End Property
Public Property Get AxisLabelYColor() As OLE_COLOR
AxisLabelYColor = uYAxisLabelColor
End Property
Public Property Get AxisLabelXColor() As OLE_COLOR
AxisLabelXColor = uXAxisLabelColor
End Property
Public Property Get AxisLabelX() As String
AxisLabelX = uXAxisLabel
End Property
Public Property Let BackColor(lngVal As OLE_COLOR)
Attribute BackColor.VB_Description = "Returns/sets the color of the chart background."
If lngVal <> UserControl.BackColor Then
UserControl.BackColor = lngVal
DrawChart
PropertyChanged "BackColor"
End If
End Property
Public Property Get BackColor() As OLE_COLOR
BackColor = UserControl.BackColor
End Property
Public Property Get MajorGridColor() As OLE_COLOR
Attribute MajorGridColor.VB_Description = "Returns/sets the color of the major grid."
MajorGridColor = uMajorGridColor
End Property
Public Property Get ChartTitleColor() As OLE_COLOR
Attribute ChartTitleColor.VB_Description = "Returns/sets the color used to display the chart title."
ChartTitleColor = uChartTitleColor
End Property
Public Property Get SaveAsCaption() As String
Attribute SaveAsCaption.VB_Description = "Returns/sets the caption of the dialog box displayed when saving the picture."
SaveAsCaption = uSaveAsCaption
End Property
Public Property Let SaveAsCaption(stgVal As String)
uSaveAsCaption = stgVal
PropertyChanged "SaveAsCaption"
End Property
Public Property Let ChartTitleColor(lngVal As OLE_COLOR)
If lngVal <> uChartTitleColor Then
uChartTitleColor = lngVal
DrawChart
PropertyChanged "ChartTitleColor"
End If
End Property
Public Property Let ChartSubTitleColor(lngVal As OLE_COLOR)
Attribute ChartSubTitleColor.VB_Description = "Returns/sets the color used to display the chart subtitle."
If lngVal <> uChartSubTitleColor Then
uChartSubTitleColor = lngVal
DrawChart
PropertyChanged "ChartSubTitleColor"
End If
End Property
Public Property Get ChartSubTitleColor() As OLE_COLOR
ChartSubTitleColor = uChartSubTitleColor
End Property
Public Property Get MinorGridColor() As OLE_COLOR
Attribute M
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?