AreaFill – Fill an area with a solid color

AreaFill – Fill an area with a solid color

Private Declare Function ExtFloodFill Lib "GDI32" (ByVal hDC As Long, _    ByVal X As Long, ByVal Y As Long, ByVal colorCode As Long, _    ByVal fillType As Long) As LongConst FLOODFILLBORDER = 0Const FLOODFILLSURFACE = 1' Fill a region using the current color or brush'   OBJ can be a form or a control that exposes'       a device context (eg a picture box)'   X,Y are given in the current system coordinates'' If BORDERCOLOR is specified, fills the area'   enclosed by a border of that color' If BORDERCOLOR is omitted, the area is filled with'   the color now at coordinates (x,y), and any'   different color is considered to a the borderSub AreaFill(obj As Object, ByVal X As Long, ByVal Y As Long, _    ByVal colorCode As Long, Optional borderColor As Variant)        Dim x2 As Long, y2 As Long    Dim saveFillStyle As Long    Dim saveFillColor As Long        With obj        ' convert into pixel coordinates        x2 = .ScaleX(X, .ScaleMode, vbPixels)        y2 = .ScaleY(Y, .ScaleMode, vbPixels)                ' save FillStyle and FillColor properties        saveFillStyle = .FillStyle        saveFillColor = .FillColor        ' enforce new properties        .FillStyle = 0        .FillColor = colorCode                If IsMissing(borderColor) Then            ' get color at given coordinates            borderColor = .Point(X, Y)            ' change all the pixels with that color            ExtFloodFill .hDC, x2, y2, borderColor, FLOODFILLSURFACE        Else            ExtFloodFill .hDC, x2, y2, borderColor, FLOODFILLBORDER        End If        ' restore properties        .FillStyle = saveFillStyle        .FillColor = saveFillColor    End WithEnd Sub

Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes