NOt the same color when I load this function

Post Reply
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

NOt the same color when I load this function

Post by Silvio »

When I load this function I insert a color as the defines :

On Main program I insert these lines

Code: Select all

 DEFINE BRUSH oPenL COLOR CLR_HBLUE  
   DEFINE BRUSH oPenR COLOR CLR_HRED
and then

Code: Select all

  disegna( nLinea+nVertic+4, nColumnaInicio+nHoriz2, nLinea+nVertic+14, nColumnaFinal+nHoriz2, oPenR )
    

the func disegna is this

Code: Select all

 
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
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: NOt the same color when I load this function

Post 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
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post 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.
Post Reply