FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour to fill a rect
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
to fill a rect
Posted: Sun Jan 29, 2006 06:00 PM
I must refill a rect :

METHOD Rectang( nTop, nLeft, nBottom, nRight, oPen ,nRecord) CLASS XXXXXXX

   local hPen := if( oPen = nil, 0, oPen:hPen )
   Local nX := oPen:nWidth / 2
   IIF( nRecord == nil , nRecord := 0  , )
   ::GetDC()
   MoveTo( ::hDC, nLeft, nTop )
   LineTo( ::hDC, nRight, nBottom, hPen )
   FillRect( nTop, nLeft, nBottom, nRight, nColor )  ?? it make me error 
   ::ReleaseDC()
 
return nil



Someone can help me please

Regards
Best Regards, Saludos



Falconi Silvio
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: to fill a rect
Posted: Sun Jan 29, 2006 06:39 PM
This is a working sample:

#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg, oBrush

    DEFINE BRUSH oBrush COLOR CLR_RED

    DEFINE DIALOG oDlg

    @ 3, 1 BUTTON "&Close" ACTION oDlg:End()

    ACTIVATE DIALOG oDlg;
             ON PAINT FILLRECT( hDC, { 10, 10, 100, 300 }, oBrush:hBrush );
             CENTER

    RELEASE BRUSH oBrush

    RETURN NIL


EMG
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
to fill a rect
Posted: Sun Jan 29, 2006 10:21 PM
thanks EMG

but I must give to my func ncolor variable
it create a rect with

Rectang( nTop, nLeft, nBottom, nRight, oPen ,nRecord)


from this command I can create a brush with the ncolor of the open I give to it

can I found the color of the open and insert to brush ?
Best Regards, Saludos



Falconi Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
to fill a rect
Posted: Sun Jan 29, 2006 10:33 PM
to understand well I explain you
in a program I run this function

    oGraficos:Rectang( nLinea+nVertic+4, nColumnaInicio+nHoriz, nLinea+nVertic+10, nColumnaFinal+nHoriz ,oPen5,dati->(Recno()) )


oGraficos is a object of a class

and into class there is this method :
METHOD Rectang( nTop, nLeft, nBottom, nRight, oPen ,nRecord) CLASS XXXXXX

   local hPen := if( oPen = nil, 0, oPen:hPen )
   Local nX := oPen:nWidth / 2
   IIF( nRecord == nil , nRecord := 0  , )
   ::GetDC()
   *Rectangle( ::hDC, nTop, nLeft, nBottom, nRight, hPen )
    MoveTo( ::hDC, nLeft, nTop )
   LineTo( ::hDC, nRight, nBottom, hPen )

   PPP

   ::ReleaseDC()
 if nRecord > 0
      aadd(::aItems,{nTop-nX,nLeft-nX,nBottom+nX,nRight+nX,nRecord})
   endif

return nil


But it create a line as a pen and I want to show a rectangule filled of the color hpen

where I insert the word "PPP" i must insert the _fillrect method but it want a brush


METHOD _FillRect( nTop, nLeft, nBottom, nRight, nColor ) CLASS XXXX

   LOCAL oBrush, hBru, hOld

   hBru := CreateSolidBrush( nColor )
   hPen := CreatePen( nColor )
   hOld := SelectObject( ::hDC, hBru )
   MoveTo( ::hDC, nLeft, nTop )
   LineTo( ::hDC, nRight, nBottom, hPen )
   FillRect( ::hDC, { nTop, nLeft, nBottom, nRight }, hBru )
   SelectObject( ::hDC, hOld )
   DeleteObject( hBru )

   RETURN (Nil)


I hope you understand now well my work

Regards
Best Regards, Saludos



Falconi Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 06:28 PM
to fill a rect
Posted: Sun Jan 29, 2006 10:37 PM

OKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK

I resolve IT

NOw RUn OKKKKKKKK

thanks to all

Falconi Silvio

Best Regards, Saludos



Falconi Silvio

Continue the discussion