bonjour a tout le monde
j'ai encore un petit problème en vb:oops:
en faite se code permet de charger une image dans une richtextbox
voila le code le 1er code
donc le soucis n'est pas laCode:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 Public Class Class_DrawRtb Public Sub add_pictures_to_rtb(ByVal pic As Image, ByVal rtb As RichTextBox, ByVal index As Integer) Dim x As Clipboard Dim a As Integer Dim b As Integer Dim tmpobj As Object tmpobj = x.GetDataObject x.SetDataObject(pic) a = rtb.SelectionStart b = rtb.SelectionLength rtb.SelectionLength = 0 rtb.SelectionStart = index rtb.Paste() x.SetDataObject(tmpobj) If index >= a Then a += 1 rtb.SelectionStart = a rtb.SelectionLength = b End Sub End Class
voici le 2eme code
voila le petit soucisCode:
1
2
3
4
5
6
7 Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Dim a As New Class_DrawRtb() a.add_pictures_to_rtb(New Bitmap(""), RichTextBox1, RichTextBox1.SelectionStart) End Sub End Class
dans new bitmap ("") normallement entre "" je doit rajouté le chemin de l'image par ex: ("essai.bmp") et donc la sa marche l'image se charge bien dans la richtextbox
mais je voudrait pouvoir rajouter un openfileDialog pour pouvoir choisir au choix n'importe quelle image en bmp
comment puis-je faire ?