Solved

polygon fill

Posted on 1998-07-29
1
422 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
[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
1 Comment
 
LVL 6

Accepted Solution

by:
clifABB earned 100 total points
ID: 1467078
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

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…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

734 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