cs_Blanc
Messages postés181Date d'inscriptiondimanche 6 juillet 2003StatutMembreDernière intervention16 octobre 2006
-
13 juil. 2004 à 18:41
cs_Blanc
Messages postés181Date d'inscriptiondimanche 6 juillet 2003StatutMembreDernière intervention16 octobre 2006
-
14 juil. 2004 à 22:30
Bonsoir,
J'aimerai savoir si quelqu'un connaissait le code qui permet de donner une forme à une fenêtre... je crois que c'est avec un path... mais je suis pas sûr... Je voudrais par exemple lui donner une forme ronde et que l'exterieur du rond soie transparent...
Je sais que c'est possible par des image... mais j'aimerai que ça soie par code....
cs_Pingouin
Messages postés262Date d'inscriptionlundi 26 août 2002StatutMembreDernière intervention24 août 2005 13 juil. 2004 à 21:00
Voivi un code qui n'est pas de moi, j'en ai laissé l'origine (Allapi.net), il est à améliorer mais bon :
Private Declare Function GetClipRgn Lib "gdi32" (ByVal hdc As Long, ByVal hRgn As Long) As Long
Private Declare Function IntersectClipRect Lib "gdi32" (ByVal hdc As Long, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function SelectClipRgn Lib "gdi32" (ByVal hdc As Long, ByVal hRgn As Long) As Long
Private Declare Function OffsetClipRgn Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long) As Long
Private Declare Function CreateEllipticRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 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
Dim hRgn As Long
Private Sub Form_Load()
'KPD-Team 2000
'URL: http://www.allapi.net/ 'E-Mail: KPDTeam@Allapi.net
Me.ScaleMode = vbPixels
End Sub
Private Sub Form_Paint()
Form_Resize
End Sub
Private Sub Form_Resize()
Dim Ret As Long
'destroy the previous region
DeleteObject hRgn
'create an elliptic region
hRgn = CreateEllipticRgn(0, 0, Me.ScaleWidth, Me.ScaleHeight)
'select this elliptic region into the form's device context
SelectClipRgn Me.hdc, hRgn
'move the clipping region
OffsetClipRgn Me.hdc, 10, 10
'generate a new clipping region
IntersectClipRect Me.hdc, 10, 10, 500, 300
'clear the form
Me.Cls
'draw a Black rectangle over the entire form
Me.Line (0, 0)-(Me.ScaleWidth, Me.ScaleHeight), vbBlack, BF
'create a temporary region
Ret = CreateEllipticRgn(0, 0, 1, 1)
'copy the current clipping region into the temporary region
GetClipRgn Me.hdc, Ret
'set the new window region
SetWindowRgn Me.hWnd, Ret, True
End Sub
Private Sub Form_Unload(Cancel As Integer)
'clean up
DeleteObject hRgn
End Sub
Private Sub Form_Click()
'unload the form when the user clicks on it
Unload Me
End Sub