Richtextbox avec images

cs_boule Messages postés 4 Date d'inscription samedi 9 novembre 2002 Statut Membre Dernière intervention 14 décembre 2002 - 2 déc. 2002 à 17:15
Zil0k Messages postés 51 Date d'inscription mercredi 26 février 2003 Statut Membre Dernière intervention 27 octobre 2004 - 13 mai 2003 à 20:48
Bonjour, je souhaite inserer des images dans un textbox est ce que quelqu'un sait comment faire. Voila le pb je recois une chaine de caractere et selon ces caracteres soit j'affiche la chaine tel quel dans la textbox soit j'affiche la chaine et j'integre une ou des images. Ainsi de suite de suite...
Merci

1 réponse

Zil0k Messages postés 51 Date d'inscription mercredi 26 février 2003 Statut Membre Dernière intervention 27 octobre 2004 1
13 mai 2003 à 20:48
Salut,

Extrait de la doc de Visual Studio .NET :

private bool pasteMyBitmap(string fileName)
{

   // Open an bitmap from file and copy it to the clipboard.
   Bitmap myBitmap = new Bitmap(fileName);
         
   // Copy the bitmap to the clipboard.
   Clipboard.SetDataObject(myBitmap);

   // Get the format for the object type.
   DataFormats.Format myFormat = DataFormats.GetFormat(DataFormats.Bitmap);

   // After verifying that the data can be pasted, paste it.
   if(richTextBox1.CanPaste(myFormat))
   {
      richTextBox1.Paste(myFormat);
      return true;
   }
   else
   {
      MessageBox.Show("The data format that you attempted to paste is not supported by this control.");
      return false;
   }
}
0
Rejoignez-nous