cs_AngeloVivaldi
Messages postés60Date d'inscriptiondimanche 8 décembre 2002StatutMembreDernière intervention 1 juillet 2004
-
30 nov. 2003 à 18:56
cs_DARKSIDIOUS
Messages postés15814Date d'inscriptionjeudi 8 août 2002StatutMembreDernière intervention 4 mars 2013
-
30 nov. 2003 à 19:31
Salut a tous
Voila, j'ai mis une image gif sur une form, le fond étan transparant, on voit la form ce qui n'est pa tres esthétique avec mon image =( j'ai utlisé le control image (pas le picturebox).
Mon problem es que je voudrai faire disparaitre la form (enfin la rendre tansparente) pour laisser ke l'image.
cs_EBArtSoft
Messages postés4525Date d'inscriptiondimanche 29 septembre 2002StatutModérateurDernière intervention22 avril 20199 30 nov. 2003 à 19:16
Regarde a fenetre transparente, il y a plein de sources qui parle de ça j'ai pas lien exact mais si tu creuse un peu tu va trouver.
Il faut utiliser SetWindowRgn avec quelque API GDI !
Option Explicit
Declare Function GetPixel Lib "gdi32" (ByVal hDC As Long, ByVal X As Long, ByVal Y As Long) As Long
Declare Function CombineRgn Lib "gdi32" (ByVal hDestRgn As Long, ByVal hSrcRgn1 As Long, ByVal hSrcRgn2 As Long, ByVal nCombineMode As Long) As Long
Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Declare Function CreateRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Public Function MakeRegion(PictBox As PictureBox, ByVal X1 As Long, ByVal Y1 As Long, ByVal W1 As Long, ByVal H1 As Long) As Long
Dim TransparentColor As Long
Dim InFirstRegion As Boolean
Dim StartLineX As Long
Dim FullRegion As Long
Dim LineRegion As Long
Dim InLine As Boolean
Dim PicHeight As Long
Dim PicWidth As Long
Dim hDC As Long
Dim X As Long
Dim Y As Long
For Y = 0 To H1 'PicHeight - 1
For X = 0 To W1 'PicWidth - 1
'If GetPixel(hDC, X + X1, Y + Y1) TransparentColor Or X PicWidth Then If GetPixel(hDC, X + X1, Y + Y1) TransparentColor Or X W1 Then
If InLine Then
InLine = False
LineRegion = CreateRectRgn(StartLineX, Y, X, Y + 1)
If InFirstRegion Then
FullRegion = LineRegion
InFirstRegion = False
Else
CombineRgn FullRegion, FullRegion, LineRegion, RGN_OR
DeleteObject LineRegion
End If
End If
Else
If Not InLine Then
InLine = True
StartLineX = X
End If
End If
Next
Next