السلام عليكم ورحمة الله وبركاته
الكود التالي لعمل برنامج تلوين صور بالتعبئه .. ارجو مساعدتي في فهمها وشرحها لي .. :(
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long Private Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor As Long) As Long Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject 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 ExtFloodFill Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal crColor As Long, ByVal wFillType As Long) As Long Const FLOODFILLBORDER = 0 ' Fill until crColor& color encountered. Const FLOODFILLSURFACE = 1 ' Fill surface until crColor& color not encountered. Const crNewColor = &HFFFF80 Dim mBrush As Long Private Sub Form_Load() 'KPD-Team 1999 'URL: http://www.allapi.net/ 'E-Mail: KPDTeam@Allapi.net 'Create a solid brush 'Select the brush into the PictureBox' device context SelectObject Picture1.hdc, mBrush 'API uses pixels Picture1.ScaleMode = vbPixels End Sub Private Sub Form_Unload(Cancel As Integer) 'Delete our new brush DeleteObject mBrush End Sub Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) 'Floodfill... ExtFloodFill Picture1.hdc, X, Y, GetPixel(Picture1.hdc, X, Y), FLOODFILLSURFACE End Sub Private Sub Picture2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 1 Then mBrush = CreateSolidBrush(Picture2.Point(X, Y)) 'mBrush = Picture2.Point(X, Y) Label1.BackColor = Picture2.Point(X, Y) SelectObject Picture1.hdc, mBrush End If End Sub