FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Filling a window fragment
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Filling a window fragment
Posted: Wed Mar 18, 2026 11:50 AM

The FloodFill function() fills the DC of the entire window. How can this be done for a specific area of the window?

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Filling a window fragment
Posted: Wed Mar 18, 2026 02:00 PM

Dear Yuri,

You may use FillRect():

FillRect( hDC, { nTop, nLeft, nBottom, nRight }, hBrush ) --> nSuccess (0 or 1)

Example of use:

#include "FiveWin.ch"  
  

function Main()  
  

   local oWnd  
  

   DEFINE WINDOW oWnd TITLE "FillRect Example"  
  

   ACTIVATE WINDOW oWnd ON PAINT PaintArea( oWnd )  
  

return nil  
  

function PaintArea( oWnd )  
  

   local oBrush  
  

   DEFINE BRUSH oBrush COLOR RGB( 255, 0, 0 )       // red  

   FillRect( oWnd:hDC, { 10, 10, 100, 200 }, oBrush:hBrush )  

   RELEASE BRUSH oBrush  
  

   DEFINE BRUSH oBrush COLOR RGB( 0, 0, 255 )       // blue  

   FillRect( oWnd:hDC, { 110, 10, 200, 200 }, oBrush:hBrush )  

   RELEASE BRUSH oBrush  
  

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: Filling a window fragment
Posted: Wed Mar 18, 2026 04:48 PM

Thank you, Antonio! That's what I did, it works well

Continue the discussion