Solved

Graphical Methodes of the PictureBox Object

Posted on 1997-11-11
4
248 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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month3 days, 11 hours left to enroll

630 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