borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (How to use the printer Object in VB ?)Next Topic (current Y and current Y locations) New Topic New Poll Post Reply
AndreaVB Forum : Printing : printing polygone and fill it with a color
Poster Message
marco
Level: Guest


icon printing polygone and fill it with a color

i can draw a polygone to the printer but how must i fill it with a coller

27-10-2002 at 11:18 AM
| Quote Reply
Filbert
Level: Guest

icon Re: printing polygone and fill it with a color

API...ExtFloodfill

22-12-2002 at 05:10 PM
| Quote Reply
vbgen
Level: Moderator

Registered: 10-10-2002
Posts: 876
icon Re: printing polygone and fill it with a color

okidokey...

i'm no printmaster, but i have an example courtesy of AllApi.Net...


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
    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


try to adapt this in your code, and manipulate it as you wish...

hope this helps.

____________________________
Been busy trying to take a second degree <--it's not working out...

23-12-2002 at 05:19 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : Printing : printing polygone and fill it with a color
Previous Topic (How to use the printer Object in VB ?)Next Topic (current Y and current Y locations) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder