|
-
Aug 10th, 2000, 10:20 PM
#1
Thread Starter
Hyperactive Member
'OK, I give up! How do I make this code turn the white boxes it makes with left click fill with Red using ExtFloodFill (Yes,I do want to use this instead of floodfill,I just need this to get started).Do I have to set other properties? I'm using VB6 and on Win98.Here's the code that doesn't work:
Private Const FLOODFILLBORDER = 0
Private Const FLOODFILLSURFACE = 1
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
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
fillcolor = VBRed
If Button = vbRightButton Then
ExtFloodFill hdc, X, Y, vbWhite, FLOODFILLSURFACE
Else
Line (CurrentX, CurrentY)-(X, Y), vbWhite, BF
End If
End Sub
-
Aug 11th, 2000, 12:04 AM
#2
Fanatic Member
Never used this API before but it's a function that returns a long... shouldn't you call it like that? The long will probably indicate success failure or maybe return a var needed else where.
Also, what Hdc are you passing it? I don't see anything declared
Paul Dwyer 
Network Engineer
Aussie In Tokyo
Using Powerbasic 6 & VB6 SP4 (Please also add your VB Version to your signature!)
-
Aug 11th, 2000, 03:44 AM
#3
Addicted Member
Try this (from the KPD-Team).
I think you need to use a brush ???
Code:
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()
'Create a solid brush
mBrush = CreateSolidBrush(crNewColor)
'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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|