VB.Net: Utilisation de Graphics.FromHwnd

darollinghobbit Messages postés 55 Date d'inscription mardi 2 mars 2004 Statut Membre Dernière intervention 18 juin 2004 - 16 juin 2004 à 15:59
darollinghobbit Messages postés 55 Date d'inscription mardi 2 mars 2004 Statut Membre Dernière intervention 18 juin 2004 - 16 juin 2004 à 16:00
Bonjour,

Je voudrai dessiner sur mon form sans utiliser l'event Paint et j'ai trouvé cette sub

Public Sub FromHwndHwnd(e As PaintEventArgs)
' Get handle to form.
Dim hwnd As New IntPtr()
hwnd = thisForm.Handle
' Create new graphics object using handle to window.
Dim newGraphics As Graphics = Graphics.FromHwnd(hwnd)
' Draw rectangle to screen.
newGraphics.DrawRectangle(New Pen(Color.Red, 3), 0, 0, 200, 100)
' Dispose of new graphics.
newGraphics.Dispose()
End Sub

Malheureusement, cela ne fonctionne pas chez moi.

Est-ce que quelqu'un sait commetn faire?

Merci

1 réponse

darollinghobbit Messages postés 55 Date d'inscription mardi 2 mars 2004 Statut Membre Dernière intervention 18 juin 2004 1
16 juin 2004 à 16:00
Oups j'ai oublié de dire que j'ai remplacé la ligne thisForm.Handle par Me.Handle
0
Rejoignez-nous