Solved

Graphical Methodes of the PictureBox Object

Posted on 1997-11-11
4
242 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB6 Compile Compatibility Issue 4 121
MS Access Search and Replace Using VBA 6 92
Add and format columns in vb6 7 70
add criteria to query in VB, Access 2003 2 29
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

735 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