Method SetText() Transparent

Post Reply
Dorneles
Posts: 30
Joined: Mon Oct 30, 2006 2:39 pm
Location: Brasil

Method SetText() Transparent

Post by Dorneles »

http://img179.imageshack.us/my.php?image=tela1oc3.png

Changed the METHOD SetText( cText ) not to exceeding the limit as shown in Image 1, only that he lost his transparency, lack what?

Code: Select all

METHOD SetText( cText ) CLASS TSSay

   local hDC , nWidth

   DEFAULT ::lTransparent := .f.

   ::cCaption := If( ::cPicture != nil,;
         		     Transform( cText, ::cPicture ),;
                    cValToChar( cText ) )
                     
   if ! lAnd( GetWindowLong( ::hWnd, GWL_STYLE ), nOr( SS_LEFT, SS_RIGHT, SS_CENTER ) ) 
      nWidth = GetTextWidth( 0, ::cCaption, If( ::oFont != nil, ::oFont:hFont,) )  
      IF nWidth > ::nWidth 
         nWidth = GetTextWidth( 0, ::cCaption, If( ::oFont != nil, ::oFont:hFont,) ) -(GetTextWidth( 0, ::cCaption, If( ::oFont != nil, ::oFont:hFont,) ) - ::nWidth) 
      ENDIF
      if nWidth > ::nWidth 
         ::nWidth = nWidth 
      endif    
   endif   
   
   SetWindowText( ::hWnd, ::cCaption )

return nil
Dorneles
Posts: 30
Joined: Mon Oct 30, 2006 2:39 pm
Location: Brasil

Post by Dorneles »

The image 2 this with the gray background, I make it transparent.
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Post by Silvio »

Dear Dorneles,

STATIC FUNCTION DrawText2( hDC, hFont, nBkMode, cText, nTop, nLeft, nWidth, nHeight )
LOCAL hFontOld:= SelectObject( hDC, hFont )
LOCAL nBkOld := SetBkMode( hDC, nBkMode )
DrawText( hDC, cText, { nTop, nLeft, nTop+nWidth, nLeft+nHeight } )
SelectObject( hDC, hFontOld )
SetBkMode( hDC, nBkOld )
RETURN( NIL )


it write trasparent on bitmap
Best Regards, Saludos

Falconi Silvio
Post Reply