Jump to content
Software FX Community

Adapdation of Q1681001 Financial Sample


User (Legacy)

Recommended Posts

Hi,

I am trying to adapt your volume brush sample to work with my candlesticks.

Everything Fires, everything apparently processes, but no color changes are

made. Any help would be appreciated.

'Global

Dim hOrigBrush As Long 'store the ChartFX Original brush

Dim hNewBrush As Long 'store the New Brush

Private Sub CreateBrush()

' create a Blue brush

hNewBrush = CreateSolidBrush(RGB(0, 0, 255))

' mark the variable as not initialized yet

hOrigBrush = 0

End Sub

Private Sub DestroyBrush()

DeleteObject (hNewBrush)

End Sub

Private Sub StoreOriginalBrush()

Dim hDeviceC As Long

If hOrigBrush = 0 Then ' the Original was not saved yet

hDeviceC = ChartFX.PaintInfo(CPI_GETDC)

' Get the selected brush

hOrigBrush = SelectObject(hDeviceC, GetStockObject(NULL_BRUSH))

ChartFX.PaintInfo CPI_RELEASEDC, hDeviceC

End If

End Sub

Private Sub SetOriginalBrush()

Dim hDeviceC As Long

If hOrigBrush <> 0 Then ' the Original was not saved yet

hDeviceC = ChartFX.PaintInfo(CPI_GETDC)

' restore the original brush

SelectObject hDeviceC, hOrigBrush

ChartFX.PaintInfo CPI_RELEASEDC, hDeviceC

hOrigBrush = 0 'there is nothing stored now

End If

End Sub

Private Sub UseBrush(hBrush As Long)

Dim hDeviceC As Long

hDeviceC = ChartFX.PaintInfo(CPI_GETDC)

SelectObject hDeviceC, hBrush

ChartFX.PaintInfo CPI_RELEASEDC, hDeviceC

End Sub

Private Sub ChartFX_PrePaintMarker(ByVal nSerie As Integer, ByVal nPoint As

Long, nRes As Integer)

'

If (timerSeconds.Enabled) And (nPoint = ChartFX.NValues - 1) Then 'If I

am Updating the chart and It's the last point

Dim hBrush As Long

StoreOriginalBrush

UseBrush (hNewBrush)

nRes = 0

Else

SetOriginalBrush

End If

'

End Sub

Private Sub ChartFX_PaintMarker(ByVal x As Integer, ByVal y As Integer,

ByVal lPaint As Long, ByVal nSerie As Integer, ByVal nPoint As Long, nRes As

Integer)

'

SetOriginalBrush

'

End Sub

Thanks in Advance,

Chase Gale

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...