Soyez le premier à donner votre avis sur cette source.
Vue 14 186 fois - Téléchargée 1 679 fois
Private Const RGN_DIFF = 4 Private Declare Function GetWindowDC Lib "user32" (ByVal hwnd As Long) As Long Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long Private Declare Function CreateRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long Private Declare Function CombineRgn Lib "gdi32" (ByVal hDestRgn As Long, ByVal hSrcRgn1 As Long, ByVal hSrcRgn2 As Long, ByVal nCombineMode As Long) As Long Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long Private Declare Function SetWindowRgn Lib "user32" (ByVal hwnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long Public Sub BackgroundTransparent(Objet As Object) Dim CouleurBackground As Long Dim hdcObjet As Long, RectFinal As Long, NewRect As Long Dim x As Integer, y As Integer On Error Resume Next hdcObjet = GetWindowDC(Objet.hwnd) CouleurBackground = GetPixel(hdcObjet, 0, 0) If CouleurBackground = -1 Then Exit Sub Objet.BackColor = CouleurBackground RectFinal = CreateRectRgn(0, 0, Objet.Width, Objet.Height) For y = 0 To Objet.Height For x = 0 To Objet.Width If GetPixel(hdcObjet, x, y) = CouleurBackground Then NewRect = CreateRectRgn(x, y, x + 1, y + 1) CombineRgn RectFinal, RectFinal, NewRect, RGN_DIFF DeleteObject (NewRect) End If Next x x = 0 Next y SetWindowRgn Objet.hwnd, RectFinal, True DeleteObject (RectFinal) End Sub Private Sub CmdStart_Click() BackgroundTransparent Option2 BackgroundTransparent Check2 BackgroundTransparent Picture1 End Sub
merci
//Naruto
a+
Vous n'êtes pas encore membre ?
inscrivez-vous, c'est gratuit et ça prend moins d'une minute !
Les membres obtiennent plus de réponses que les utilisateurs anonymes.
Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.
Le fait d'être membre vous permet d'avoir des options supplémentaires.