BOX change color how?

BOX change color how?

Postby Otto » Thu Mar 02, 2006 7:38 am

How can I change the color of a box?

METHOD IVBox(nRow,nCol1,nCol2,nRow2) CLASS TInvoice
::box (nRow,nCol1,nRow2,nCol2,nPen )
return nil

Thanks in advance
Otto
User avatar
Otto
 
Posts: 6338
Joined: Fri Oct 07, 2005 7:07 pm

Re: BOX change color how?

Postby Enrico Maria Giordano » Thu Mar 02, 2006 7:48 am

Of which class is the Box() method you are calling?

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Otto » Thu Mar 02, 2006 8:04 am

Thank you for your answer.
Here are more infos.

Tanti saluti
Otto



// Class. Mainly used for Automatic Alignment techniques

#include "FiveWin.ch"

#ifdef __XPP__
#define Super ::TControl
#define New _New
#endif

//----------------------------------------------------------------------------//

CLASS TInvoice FROM TControl

CLASSDATA lRegistered AS LOGICAL

METHOD New( nTop, nLeft, nBottom, nRight, oWnd ) CONSTRUCTOR

METHOD IVHeader()

METHOD IVBody()

METHOD IVFooter()

METHOD IVClear()

METHOD IVSay()

METHOD IVBox()

METHOD IVLine()

ENDCLASS

//----------------------------------------------------------------------------//

METHOD New( nTop, nLeft, nBottom, nRight, oWnd ) CLASS TInvoice

DEFAULT nTop := 0, nLeft := 0, nBottom := 100, nRight := 100,;
oWnd := GetWndDefault()

::nTop = nTop
::nLeft = nLeft
::nBottom = nBottom
::nRight = nRight
::oWnd = oWnd
//::nStyle = nOr( WS_CHILD, WS_VISIBLE )
::nStyle = nOr( WS_CHILD, WS_VISIBLE, WS_TABSTOP )

::lDrag = .f.

::Register()

if ! Empty( ::oWnd:hWnd )
::Create()
::oWnd:AddControl( Self )
else
::oWnd:DefControl( Self )
endif

return Self

//----------------------------------------------------------------------------//

METHOD IVHeader(nRowHeader,Font1,Font2,Font3) CLASS TInvoice
::say(nRowHeader , 20, "ArtNr" ,255,16777215,Font3,.T.)
::say(nRowHeader , 100, "Bezeichnung" ,255,16777215,Font1,.T.)
::say(nRowHeader , 500, "Preis" ,255,16777215,Font2,.T.)
nRowHeader += Font2:nHeight
::say( nRowHeader, 500, "inkl. MWST" ,255,16777215,Font3,.T.)
nRowHeader += Font2:nHeight
return nil

//----------------------------------------------------------------------------//

METHOD IVBody() CLASS TInvoice

return nil

//----------------------------------------------------------------------------//

METHOD IVFooter(nRowFooter,Font1,Font2,Font3) CLASS TInvoice
nRowFooter += Font2:nHeight/2
::line (nRowFooter,11,nRowFooter,700 )
nRowFooter += Font2:nHeight/2

::say(nRowFooter , 20, "ArtNr" ,255,16777215,Font3,.T.)
::say(nRowFooter , 100, "Summe" ,255,16777215,Font1,.T.)
::say(nRowFooter , 500, "999,99" ,255,16777215,Font2,.T.)
nRowFooter += Font2:nHeight
::say( nRowFooter, 500, "inkl. MWST" ,255,16777215,Font3,.T.)
nRowFooter += Font2:nHeight

return nil

//----------------------------------------------------------------------------//

METHOD IVClear(nRow,Font1) CLASS TInvoice
local nRowHelp := 0
local I:=0
nRowHelp := nRow
FOR I = 1 TO 15
::say( nRowHelp, 1, space(1000),255,16777215,Font1,.T.)
nRowHelp += Font1:nHeight
NEXT

return nil

//----------------------------------------------------------------------------//

METHOD IVSay(nRow,nCol,cLine,nClrFore,nClrBack,oFont) CLASS TInvoice
::say( nRow,nCol,cLine,nClrFore,nClrBack,oFont,.T.)
return nil

METHOD IVLine(nRow,nCol1,nCol2) CLASS TInvoice
::Line (nRow,nCol1,nRow,nCol2 )
return nil

METHOD IVBox(nRow,nCol1,nCol2,nRow2) CLASS TInvoice
::box (nRow,nCol1,nRow2,nCol2 )
return nil
User avatar
Otto
 
Posts: 6338
Joined: Fri Oct 07, 2005 7:07 pm

Postby Enrico Maria Giordano » Thu Mar 02, 2006 10:18 am

Otto wrote:Thank you for your answer.
Here are more infos.


Your class inherits from TControl. Then, if I'm not wrong, you are calling TWindow:Box() method that doesn't have nPen parameter, right?

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Otto » Thu Mar 02, 2006 10:22 am

You are right.
You think I could draw my own box - 4 lines?
Regards
Otto
User avatar
Otto
 
Posts: 6338
Joined: Fri Oct 07, 2005 7:07 pm

Postby Enrico Maria Giordano » Thu Mar 02, 2006 12:08 pm

This is a working sample:

Code: Select all  Expand view  RUN
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg

    DEFINE DIALOG oDlg

    ACTIVATE DIALOG oDlg;
             ON PAINT DRAWBOX( oDlg, hDC, 10, 10, 100, 100, CLR_HRED );
             CENTER

    RETURN NIL


STATIC FUNCTION DRAWBOX( oDlg, hDC, nTop, nLeft, nBottom, nRight, nColor )

    LOCAL hPen := CREATEPEN( PS_SOLID, 1, nColor )

    LOCAL hOldPen := SELECTOBJECT( hDC, hPen )

    MOVETO( hDC, nLeft, nTop )
    LINETO( hDC, nRight, nTop )
    LINETO( hDC, nRight, nBottom )
    LINETO( hDC, nLeft, nBottom )
    LINETO( hDC, nLeft, nTop )

    SELECTOBJECT( hDC, hOldPen )

    DELETEOBJECT( hPen )

    RETURN NIL


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Otto » Thu Mar 02, 2006 4:51 pm

Thank you.

Otto
User avatar
Otto
 
Posts: 6338
Joined: Fri Oct 07, 2005 7:07 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 65 guests