Comment sauvegarder une msflexgrid en une image
Merci
Version imprimable
Comment sauvegarder une msflexgrid en une image
Merci
Par codage VB6 dans ton programme qui utilise ce msflexgrid ?
Manuellement ?
Voila un exemple par code VB
Sur un Form 1 CommandButton 1 PictureBox et 1 FlexGridCode:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 Option Explicit 'pour dessiner dans le picture de recuperation Private Declare Function BitBlt Lib "gdi32.dll" (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 Const SRCCOPY As Long = &HCC0020 'variables d'adaptation des différantes mesures Dim LargeuR As Integer, HauteuR As Integer Private Sub Form_Load() PictureCapt.AutoRedraw = True PictureCapt.ScaleMode = vbPixels PictureCapt.Visible = False 'il n'est pas utile que l'image recuperé soit visible End Sub Private Sub Command1_Click() 'Dimensionne le picture PictureCapt.Height = MSFlexGrid1.Height PictureCapt.Width = MSFlexGrid1.Width 'convertion en pixels LargeuR = ScaleX(MSFlexGrid1.Width, vbTwips, vbPixels) HauteuR = ScaleY(MSFlexGrid1.Height, vbTwips, vbPixels) 'dessine sur le picture BitBlt PictureCapt.hDC, 0, 0, LargeuR, HauteuR, GetDC(MSFlexGrid1.hwnd), -1, -1, SRCCOPY PictureCapt.Refresh 'sauvegarde dans un fichier 'SavePicture PictureCapt.Image, "C:\PersoFrancis\ImageGrid.BMP" End Sub
1000 merci
mais il faut ajouter
Code:Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
:oops:
Mauvais copier/coller, mais comme tu es un bon ;), je vois que tu as corrigé, :king:
Salut