Jump to content
Fivewin Brasil

Mudar a cor do GET quando for desabilitado


Jmsilva

Recommended Posts

Não é possivel mudar a cor quando com WHEN( .F. ), mas dá para deixar mais visivel.

METHOD Paint() CLASS TGet
 
   local aInfo := ::DispBegin()
   Local hOldFont
 
   //-> Mudan‡as Feitas em 22/12/2005 Por Antonio Linares
   //-> Para que o When(.F.) do GET, fique colorido normal. Muito bom. Joao.
 
   if ::oBrush != nil
      FillRect( ::hDC, GetClientRect( ::hWnd ), ::oBrush:hBrush )
   else
      CallWindowProc( ::nOldProc, ::hWnd, WM_ERASEBKGND, ::hDC, 0 )
   endif
 
   if IsWindowEnabled( ::hWnd )
 
      CallWindowProc( ::nOldProc, ::hWnd, WM_PAINT, ::hDC, 0 )
 
   else
 
      SetTextColor( ::hDC, ::nClrText ) 
      SetBkColor( ::hDC, ::nClrPane ) 
      hOldFont = SelectObject( ::hDC, ::oFont:hFont ) 
      
      do case 
         case lAnd( GetWindowLong( ::hWnd, GWL_STYLE ), ES_CENTER ) 
              SetTextAlign( ::hDC, TA_CENTER ) 
              ExtTextOut( ::hDC, 0, ::nWidth() / 2,                           ;
              { 0, 0, ::nHeight(), ::nWidth() }, GetWindowText( ::hWnd ) )
              
         case lAnd( GetWindowLong( ::hWnd, GWL_STYLE ), ES_RIGHT ) 
              SetTextAlign( ::hDC, TA_RIGHT ) 
              ExtTextOut( ::hDC, 0, ::nWidth() - 4,                           ;
              { 0, 0, ::nHeight(), ::nWidth() }, GetWindowText( ::hWnd ) )
              
         otherwise 
              SetTextAlign( ::hDC, TA_LEFT ) 
              ExtTextOut( ::hDC, 0, 0,                                        ;
              { 0, 0, ::nHeight(), ::nWidth() }, GetWindowText( ::hWnd ) )
      endcase 
 
      SelectObject( ::hDC, hOldFont )
 
   endif
 
   if ValType( ::bPainted ) == "B"
      Eval( ::bPainted, ::hDC, ::cPS, Self )
   endif
 
   ::DispEnd( aInfo )
 
return 1
Link to comment
Share on other sites

Kapiaba, você está errado, dá para mudar, é só alterar onde deixei grifado e nas duas linhas abaixo.

Quem postou parece que não lê, senão já teria encerrado o tópico.

Desculpe a sinceridade, abraço.

A versão dele não tem os novos recursos...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...