IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

VB.NET Discussion :

Split image avec TableLayoutPanel1


Sujet :

VB.NET

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre éprouvé
    Homme Profil pro
    Étudiant
    Inscrit en
    Janvier 2018
    Messages
    323
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Nord (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2018
    Messages : 323
    Par défaut Split image avec TableLayoutPanel1
    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 : 101
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

  2. #2
    Membre éprouvé
    Homme Profil pro
    Étudiant
    Inscrit en
    Janvier 2018
    Messages
    323
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Nord (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Janvier 2018
    Messages : 323
    Par défaut
    Bonjour,

    j'ai trouver la solution à mon problème mais je voudrais savoir si vous avez plus simple pour enregistrer les cases en bleu dans TableLayoutPanel1.

    mon code :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    Dim img As New Bitmap(FilePath)
                Dim one_img_h As Integer = img.Height / NumericUpDown1.Value
                Dim one_img_w As Integer = img.Width / NumericUpDown2.Value
                For i As Integer = 0 To NumericUpDown1.Value - 1
                    For j As Integer = 0 To NumericUpDown2.Value - 1
                        imgarray(i, j) = New Bitmap(one_img_w, one_img_h)
                        Dim graphics As Graphics = graphics.FromImage(imgarray(i, j))
                        graphics.DrawImage(img, New Rectangle(0, 0, one_img_w, one_img_h), New Rectangle(j * one_img_w, i * one_img_h, one_img_w, one_img_h), GraphicsUnit.Pixel)
                        graphics.Dispose()
                    Next
                Next
                For i As Integer = 0 To CInt(NumericUpDown1.Value) - 1
                    For j As Integer = 0 To CInt(NumericUpDown2.Value) - 1
                        imgarray(i, j).Save(Path.Combine(folder.SelectedPath, "SplitImage-" & CInt(i) & "-" & CInt(j) & ".png"), ImageFormat.Png)
                    Next
                Next

Discussions similaires

  1. [Python 3.X] Split une image avec opencv
    Par dentfree dans le forum Bibliothèques tierces
    Réponses: 2
    Dernier message: 05/12/2019, 09h27
  2. Réponses: 3
    Dernier message: 26/03/2012, 23h29
  3. split - function avec image
    Par mimagyc dans le forum Général JavaScript
    Réponses: 12
    Dernier message: 13/05/2008, 22h35
  4. PB affichage d'image avec IE
    Par arturo dans le forum Modules
    Réponses: 6
    Dernier message: 25/09/2003, 17h28
  5. [VB6] Affichage d'image avec qlq contraintes
    Par youri dans le forum VB 6 et antérieur
    Réponses: 3
    Dernier message: 21/11/2002, 14h44

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo