Page 1 of 1

NOt the same color when I load this function

PostPosted: Sun Feb 05, 2006 10:46 am
by Silvio
When I load this function I insert a color as the defines :

On Main program I insert these lines

Code: Select all  Expand view
DEFINE BRUSH oPenL COLOR CLR_HBLUE 
   DEFINE BRUSH oPenR COLOR CLR_HRED


and then
Code: Select all  Expand view
  disegna( nLinea+nVertic+4, nColumnaInicio+nHoriz2, nLinea+nVertic+14, nColumnaFinal+nHoriz2, oPenR )
   



the func disegna is this
Code: Select all  Expand view

Func disegna ( nTop, nLeft, nBottom, nRight, nColor )
   LOCAL oBrush, hBru, hOld

   hBru := CreateSolidBrush( nColor )
   hPen := CreatePen( nColor )
   hOld := SelectObject( hDC, hBru )
    Rectangle( hDC, nTop, nLeft, nBottom, nRight, hPen )
  * MoveTo( hDC, nLeft, nTop )
  * LineTo( hDC, nRight, nBottom, hPen )


  FillRect( hDC, { nTop + 2, nLeft + 2, nBottom, nRight }, hBru )

   SelectObject( hDC, hOld )
   DeleteObject( hBru )

   RETURN (Nil)




but the procedure draw black rectangules ...why ?

I want blu or red rectang


Best Regards

Re: NOt the same color when I load this function

PostPosted: Sun Feb 05, 2006 11:31 am
by Enrico Maria Giordano
You haven't defined hDC (or you have not reported here the relevant code). Please post a reduced and self-contained sample of the problem.

EMG

PostPosted: Mon Feb 06, 2006 8:16 am
by Silvio
Sorry I try to explain my problem
I definited hdc .
I insert here a func but it is a part of my class...
i cannot post here the class now
but when i erase fillrect line and define Pen instead define Brush it make a rect empty : a rectangule with border but empty i want refill this rect with he same color i selected.