Вот мой код
- Код: Выделить всё
Function LongToRGB(nColor As Long) As tRGB
LongToRGB.R = nColor And &HFF&
LongToRGB.G = (nColor And &HFF00&) / &H100&
LongToRGB.B = (nColor And &HFF0000) / &H10000
End Function
Sub Virez(Owner As Form)
Dim Col As tRGB
Dim nach As Integer
Dim est As Byte
Dim x As Long
Dim y As Long
Dim FullRgn As Long
Dim Rgn As Long
Owner.ScaleMode = 3
FullRgn = CreateRectRgn(0, 0, Owner.Width, Owner.Height)
Rgn = CreateRectRgn(0, 0, Owner.Width, Owner.Height)
CombineRgn FullRgn, FullRgn, Rgn, RGN_DIFF
For y = 0 To Owner.BGPic.Height
nach = 0
For x = 0 To Owner.BGPic.Width
Col = LongToRGB(GetPixel(Owner.BGPic.hdc, x, y))
If Col.R = 255 And Col.G = 255 And Col.B = 255 Then
If est = 1 Then
Rgn = CreateRectRgn(nach, y, x, y + 1)
CombineRgn FullRgn, FullRgn, Rgn, RGN_OR
est = 0
End If
nach = x + 1
Else
est = 1
If x = Owner.BGPic.Width - 1 Then
Rgn = CreateRectRgn(nach, y, x, y + 1)
CombineRgn FullRgn, FullRgn, Rgn, RGN_OR
End If
End If
Next x
Next y
SetWindowRgn Owner.hwnd, FullRgn, True
End Sub