Urvin писал(а):Вроде бы нашел функцию а АПИ - для заливки картинки чем-то типа цвета. Не работает как хотелось бы. Могет кто знать об этом факте?
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()
Me.ScaleMode = vbPixels
End Sub
Private Sub Form_Unload(Cancel As Integer)
DeleteObject mBrush
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
mBrush = CreateSolidBrush(RGB(Rnd * 255, Rnd * 255, Rnd * 255))
SelectObject Me.hdc, mBrush
ExtFloodFill Me.hdc, x, y, GetPixel(Me.hdc, x, y), FLOODFILLSURFACE
End Sub
Потести.... Первый раз кликни на форме, потом раздвинь форму и кликни на незакрашенной оласти. Вот и всё...