Solved

polygon fill

Posted on 1998-07-29
1
419 Views
Last Modified: 2010-05-18
Is there a routine to fill a polygon (other than the predefined shapes like triangle, circle) with a color? Example: in a state map, borders of individual states are defined by set of X/Y coordinates forming an irregular polygon.
0
Comment
Question by:xagpk
1 Comment
 
LVL 6

Accepted Solution

by:
clifABB earned 100 total points
Comment Utility
Place this code in the Declarations section:
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

The following procedure will fill the area from the point specified in the color specified:
Private Sub FillArea(X As Long, Y As Long, lColor As Long)
  Dim lOldColor As Long
  Dim lFillType As Long
  Dim lRes      As Long
  Const FLOODFILLBORDER = 0  ' Fill until lColor color encountered.
  Const FLOODFILLSURFACE = 1 ' Fill surface until lColor color not
                             ' encountered.
  Picture1.FillColor = lColor
  lOldColor = Picture1.Point(X, Y)
  lFillType = FLOODFILLSURFACE
  lRes = ExtFloodFill(Picture1.hdc, X / Screen.TwipsPerPixelX, Y / Screen.TwipsPerPixelY, lOldColor, lFillType)
End Sub
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…

763 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

6 Experts available now in Live!

Get 1:1 Help Now