Se vuoi ti potrei fornire le tre funzioni che definiscono i colori RGB (Red, Green e Bleu) e con una piccola variante alla routine che attualmente uso per i grafici, ti appare in MsgBox il colore scelto.
codice:
'Rosso:
Public Function RedFromRGB(ByVal rgb As Long) As Integer 'Modifica del colore
RedFromRGB = &HFF& And rgb
End Function
'Verde:
Public Function GreenFromRGB(ByVal rgb As Long) As Integer 'Modifica del colore
GreenFromRGB = (&HFF00& And rgb) \ 256
End Function
'Bleu:
Public Function BlueFromRGB(ByVal rgb As Long) As Integer 'Modifica del colore
BlueFromRGB = (&HFF0000 And rgb) \ 65536
End Function
Poi il metodo ShowColor:
codice:
'Consente di modificare il colore di una serie facendo doppio clic su di essa:
Private Sub MSChartExtra_SeriesActivated(Series As Integer, _
MouseFlags As Integer, Cancel As Integer)
Dim Red, Green, blue As Integer
With FrmTIRext.CommonDialogExtra
.CancelError = True 'Imposta CancelError su True
On Error GoTo ErrHandler
.ShowColor
Red = RedFromRGB(.Color)
Green = GreenFromRGB(.Color)
blue = BlueFromRGB(.Color)
ErrHandler:
If Err.Number = 32755 Then 'é stato scelto Annulla
Exit Sub
End If
End With
'L'oggetto Pen è utilizzato soltanto nei grafici a
'barre 2D e 3D - in tutti gli altri tipi è utilizzato l'oggetto Brush:
If FrmTIRext.MSChartExtra.chartType <> VtChChartType3dLine Then
FrmTIRext.MSChartExtra.Plot.SeriesCollection(Series).DataPoints(-1).Brush.FillColor.Set Red, Green, blue
If (Red = 128) And (Green = 255) And (blue = 128) Then
MsgBox ("Il colore scelto è verde chiaro")
End If
End If
End Sub
In rosso ho messo il messaggio che deriva dall'If della combinazione dei tre colori di base.
Ciao