Bonjour
voilà j'ai créé une classe :
Code C# : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 private void OuvrirImage() { // Affiche Boite de dialogue { if (ofdSelectionImage.ShowDialog() == DialogResult.OK) {//Charge l'image imgAfficherImage.Image = Image.FromFile(ofdSelectionImage.FileName); this.Text = string.Concat("Vsio(" + ofdSelectionImage.FileName + ")"); }} } private void btnSelectionImage_Click(object sender, EventArgs e) { OuvrirImage(); }
Sur l'évènement quand j'appel la méthode OuvrirImage (); celle ci fonctionne
même si je l'appel en faisant : this.OuvrirImage();
Alors que quand je cré une classe pour faire un rectangle :
Code C# : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 private void Tracerbordure(PictureBox objPictureBox) { Graphics objGraphics = null; objGraphics = this.CreateGraphics(); objGraphics.Clear(SystemColors.Control); objGraphics.DrawRectangle(Pens.BlanchedAlmond, imgAfficherImage.Left - 1, imgAfficherImage.Top - 1, imgAfficherImage.Width + 1, imgAfficherImage.Height); objGraphics.Dispose(); }
cette dernière ne fonctionne pas si je l'appel sans le this
ex :
Code C# : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 private void btnDessinerBord_Click(object sender, EventArgs e) { this.Tracerbordure(imgAfficherImage); }
Pourriez vous m'éclairer
merci
alex
Partager