Bonjour,

je suis entrain de créer un Split image avec TableLayoutPanel1 mais j'arrive obtenir le méme format des cases dans TableLayoutPanel1 en couleur bleu (voir image).
voir en image :
Nom : split2.png
Affichages : 109
Taille : 221,9 Ko

voici le code enregistrement:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
Dim img As New Bitmap(FilePath) 
            For i As Integer = 0 To NumericUpDown1.Value - 1
                For y As Integer = 0 To NumericUpDown2.Value - 1
                    Dim r As New Rectangle(i * (img.Width / CInt(NumericUpDown1.Value)), y * (img.Height / CInt(NumericUpDown2.Value)), img.Width / CInt(NumericUpDown1.Value), img.Height / CInt(NumericUpDown2.Value))
                    cropImage(img, r).Save(Path.Combine(folder.SelectedPath, "SplitImage-" & CInt(i) & "-" & CInt(y) & ".png"), ImageFormat.Png)
                Next
            Next
 
Private Shared Function cropImage(ByVal img As Image, ByVal cropArea As Rectangle) As Image
        Dim bmpImage As New Bitmap(img)
        Dim bmpCrop As Bitmap = bmpImage.Clone(cropArea, System.Drawing.Imaging.PixelFormat.DontCare)
        Return CType(bmpCrop, Image)
    End Function
j'aimerai avoir les mèmes formats des images dans les des cases en bleu dans TableLayoutPanel1 (voir photo)? merci d'avance