Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
878 connectés 

  FORUM HardWare.fr
  Programmation

  [VB] Couleur des graphes MSCHART

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

[VB] Couleur des graphes MSCHART

n°28787
nix_
Posté le 02-05-2001 à 15:22:46  profilanswer
 

Bonjour,  
Je voudrais changer les couleurs de mes graphes MSCHART dans mon source vb ( donc sans faire propriété du MSCHART dans l'éditeur VB ).
Si quelq'un sait comment k'on fait, je suis méga-prenneur! ;)
Merci!

mood
Publicité
Posté le 02-05-2001 à 15:22:46  profilanswer
 

n°28965
nix_
Posté le 03-05-2001 à 13:16:59  profilanswer
 

up!

n°28978
Bendes
Posté le 03-05-2001 à 13:56:47  profilanswer
 

Exemple pris dans MSDN :
 
Change the Color of MSChart Objects Using the CommonDialog Control
 
You may wish to allow the user to pick the colors assigned to chart elements (such as the color of series) using the CommonDialog control. In that case, you can use the following functions that mask the bytes returned by the CommonDialog control's Color property to return individual red, green, and blue values required by the Set method.
 
' Paste these functions into the Declarations section  
' of the Form or Code Module.
Public Function RedFromRGB(ByVal rgb As Long) _
   As Integer
   ' The ampersand after &HFF coerces the number as a  
   ' long, preventing Visual Basic from evaluating the  
   ' number as a negative value. The logical And is  
   ' used to return bit values.
   RedFromRGB = &HFF& And rgb
End Function
 
Public Function GreenFromRGB(ByVal rgb As Long) _
   As Integer
   ' The result of the And operation is divided by  
   ' 256, to return the value of the middle bytes.  
   ' Note the use of the Integer divisor.
   GreenFromRGB = (&HFF00& And rgb) \ 256
End Function
 
Public Function BlueFromRGB(ByVal rgb As Long) _
   As Integer
   ' This function works like the GreenFromRGB above,  
   ' except you don't need the ampersand. The  
   ' number is already a long. The result divided by  
   ' 65536 to obtain the highest bytes.
   BlueFromRGB = (&HFF0000 And rgb) \ 65536
End Function
 
Using the functions in the preceding examples, you can take the Long value returned by the CommonDialog object, and set the color of MSChart objects. The example below allows the user to change the color of a Series by double-clicking it:
 
Private Sub MSChart1_SeriesActivated(Series As _
   Integer, MouseFlags As Integer, Cancel As Integer)
   ' The CommonDialog control is named dlgChart.
   Dim red, green, blue As Integer
   With dlgChart ' CommonDialog object
      .ShowColor  
      red = RedFromRGB(.Color)
      green = GreenFromRGB(.Color)
      blue = BlueFromRGB(.Color)
   End With
 
   ' NOTE: Only the 2D and 3D line charts use the
   ' Pen object. All other types use the Brush.
 
   If MSChart1.chartType <> VtChChartType2dLine Or _
   MSChart1.chartType <> VtChChartType3dLine Then
      MSChart1.Plot.SeriesCollection(Series). _
         DataPoints(-1).Brush.FillColor. _
         Set red, green, blue
   Else
      MSChart1.Plot.SeriesCollection(Series).Pen. _
         VtColor.Set red, green, blue
   End If
End Sub


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation

  [VB] Couleur des graphes MSCHART

 

Sujets relatifs
[JAVA] sources de trucs de base genre arbres, piles, files, graphes..Comment changer la couleur des Contrôles texte Static en C Win32 Api ?
barre de defilllement de couleurConseil pour couleur dans anim flash
[Javascript]Comment changer la couleur d'un lien au passage du curseurcouleur transparente
couleur d'un input type=text???C++ et les affichages de texte en couleur ?
(HTML) URGENT : changer la couleur d'un TEXTE au survol du curseur 
Plus de sujets relatifs à : [VB] Couleur des graphes MSCHART


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR