ارجو شرح هذا البرنامج (بالفيجيوال بيسك 6 )

emi

New Member
بسم الله الرحمن الرحيم ..

عندي هذا البرنامج الذي يقوم بتحويل الفورم الى صورة .. اريد ان افهمة وقد حاولت ولكني مبتدئة في الفيجيوال واريد حقا فهم الكود لانه يفيدني جدا في مشروع التخرج، لذلك ارجو شرح الكود بالتفصيل الممل :biggrin2: ساكون شاكرة جدا لكم ..

تحياتي
 
البرنامج لم ينزل مع المرفقات بسبب الحجم .. ها هو الكود

user control

' ############################# '
' ############################### '
' ################################# '
' #######Coded By BelalHamdy######### '
' ########BelalHamdy@yahoo.com######### '
'#######################################'
' ######## Coded For ArabTeam ######### '
' ### Http://www.arabteam2000.com ### '
' ################################# '
' ############################### '
' ############################# '
Private Declare Function SendMessage Lib "User32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Sub ReleaseCapture Lib "User32" ()
Private Declare Function GetPixel Lib "gdi32" (ByVal hDC As Long, ByVal X As Long, ByVal Y As Long) As Long
Private Declare Function SetWindowRgn Lib "User32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) 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
Public Function ShapPic(Fm As Object)
Dim Tl As Long
Dim Vx As Long
Fm.BorderStyle = vbBSNone
Fm.Visible = False
Fm.Width = Picture1.Picture.Width / 1.75
Fm.Height = Picture1.Picture.Height / 1.75
Fm.Picture = Picture1.Picture
Rgn = CreateRectRgn(-1, -1, -1, -1)
With Picture1
Trans = GetPixel(.hDC, 0, 0)
For Y = 0 To .ScaleHeight - 1
For X = 0 To .ScaleWidth - 1
If GetPixel(.hDC, X, Y) <> Trans Then
If T1 = 0 Then
T1 = 1
Vx = X
End If
Else
If T1 = 1 Then
T1 = 0
Rgn1 = CreateRectRgn(Vx, Y, X, Y + 1)
CombineRgn Rgn, Rgn, Rgn1, 2
DeleteObject Rgn1
End If
End If
Next
Next
SetWindowRgn Fm.hWnd, Rgn, True
DeleteObject Rgn
End With
Fm.Visible = True
End Function

'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
'MappingInfo=Picture1,Picture1,-1,Picture
Public Property Get Picture() As Picture
Set Picture = Picture1.Picture
End Property

Public Property Set Picture(ByVal New_Picture As Picture)
Set Picture1.Picture = New_Picture
PropertyChanged "Picture"
End Property

'Load property values from storage
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)

Set Picture = PropBag.ReadProperty("Picture", Nothing)
End Sub

Private Sub UserControl_Resize()
Width = 24 * 15
Height = 24 * 15
End Sub

'Write property values to storage
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)

Call PropBag.WriteProperty("Picture", Picture, Nothing)
End Sub
Public Function DragForm(Fm As Object, Button As Integer)
If Button = 1 Then
ReleaseCapture
SendMessage Fm.hWnd, 161, 2, 0&
End If
End Function

in the form
Private Sub Form_Load()
Trans1.ShapPic Me
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Trans1.DragForm Me, Button
End Sub
 
عودة
أعلى