Solved

Graphical Methodes of the PictureBox Object

Posted on 1997-11-11
4
235 Views
Last Modified: 2010-05-18
I use a filling algorithm along with the point and pset methods of the picturebox to fill or mask shapes contained in a bitmap like a tree or a house
this way seems to be rather slow
is there any other way which enabels me to perform graphical analysis and changes to a bitmap rather than pset
, point methods
 
0
Comment
Question by:never
4 Comments
 
LVL 3

Expert Comment

by:wolfcrag
ID: 1440561
Take a look at the FloodFill and ExtFloodFill API's. What they do is (quickly) fill an area (in a device context) which is defined by a single boundary color. Here is an example of using FloodFill to fill a triangle:

' Place the following code in the declarations section of the form.
Private Declare Sub FloodFill Lib "GDI32" Alias "FloodFill" _
 (ByVal hDC As Long, ByVal X As Long, ByVal Y As _
 Long, ByVal crColor As Long) As Long

Private Sub Form_Click ()
    ScaleMode = vbPixels        ' Windows draws in pixels.
    ForeColor = vbBlack        ' Set draw line to black.
    Line (100, 50)-(300, 50) ' Draw a triangle.
    Line -(200, 200)
    Line -(100, 50)
    FillStyle = vbFSSolid    ' Set FillStyle to solid.
    FillColor = RGB(128, 128, 255)     ' Set FillColor.
   ' Call Windows API to fill.
    FloodFill hDC, 200, 100, ForeColor
End Sub
0
 

Author Comment

by:never
ID: 1440562
yes floodfill API dose fill areas bounded by a color ,but i need somthing that fill areas bounded by diffrent colors , or as I said, I need somthing to perform the action of POINT and PSET methods faster than they do,thanks.
0
 
LVL 8

Accepted Solution

by:
mrmick earned 50 total points
ID: 1440563
You can access bitmap data as an array.  It's not an easy method.  Get the scoop in the October 1997 Visual Basic Programmer's Journal article titled "Write Faster Apps with VB Pointers".

In regard to the floodfill issue, You can floodfill an area bounded by different colors by using the FLOODFILLSURFACE as the fill type.  In this case, the fill area is defined by the color that is specified by FillColor. Filling continues outward in all directions as long as the FillColor is encountered.

0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1440564
Bought This Question.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now