OVH Cloud OVH Cloud

MSChart

1 réponse
Avatar
Ingrid bauer
Salut tout le monde,

c'est quoi le code pour imprimer un MSChart ?

Merci d'avance

Ingrid

1 réponse

Avatar
François Picalausa
Bonjour/soir,

Voici un deux méthodes pour copier vers un picturebox.
La méthode est applicable pour copier vers l'objet printer:

1/ Méthode simple, en VB.
Efface le presse papier, ce qui peut être génant

MSChart1.EditCopy
Picture1.Picture = Clipboard.GetData(vbCFBitmap)

2/ Méthode par API. N'efface pas le clipboard

Private Declare Function GetDC _
Lib "user32" _
( _
ByVal hwnd As Long _
) _
As Long
Private Declare Function BitBlt _
Lib "gdi32" _
( _
ByVal hDestDC As Long, _
ByVal x As Long, _
ByVal y As Long, _
ByVal nWidth As Long, _
ByVal nHeight As Long, _
ByVal hSrcDC As Long, _
ByVal xSrc As Long, _
ByVal ySrc As Long, _
ByVal dwRop As Long _
) _
As Long

Private Sub Command1_Click()
Dim hDcChart As Long
Me.ScaleMode = 3 'Pixels

'Retrouver le DC du chart
hDcChart = GetDC(MSChart1.hwnd)
'Copie l'image
BitBlt Picture1.hDC, 0, 0, MSChart1.Width, MSChart1.Height, hDcChart, 0,
0, vbSrcCopy
End Sub

--
François Picalausa (MVP VB)
FAQ VB : http://faq.vb.free.fr
MSDN : http://msdn.microsoft.com


"Ingrid bauer" a écrit dans le message de
news:bac601c3ecb1$b3c90c90$
c'est quoi le code pour imprimer un MSChart ?