Rochinha, quem sabe... Sabe!!! kkkkkkkkkkkkkkkkk, abs.
#Include "FiveWin.ch"
function Main()
local oDlg, cTest := "hola"+Space( 20 ), oGet, oGet2
local obtn
DEFINE DIALOG oDlg
@ 1, 3 GET oGet VAR cTest OF oDlg SIZE 100, 13
oget:bPainted = { || LightBorder( oGet, oGet:lFocused , .f. ) }
@ 3, 3 GET oGet2 VAR cTest OF oDlg SIZE 100, 13
oget2:bPainted = { || LightBorder( oGet2, oGet2:lFocused , .T. ) }
ACTIVATE DIALOG oDlg CENTERED
return nil
function LightBorder( oGet, lFocus, lRounded )
local hDC := oGet:oWnd:GetDC()
local hBrush, hOldBrush, n
local aTopLeft, aBottomRight
local oPen,hPen1
local aRect := GetClientRect( oGet:hWnd )
LOCAL aGrdBack1 := { { 0.5, oget:ownd:nClrPane, nRGB(234 ,244, 252 ) },{ 0.5, nRGB(234 ,244, 252 ), nRGB(214 ,234,249 ) } }
LOCAL aGrdBack2 := { { 0.5, nRGB(214 ,234, 249 ), nRGB(234 ,244,252 ) }, { 0.5, nRGB(234 ,244, 252 ), oget:ownd:nClrPane} }
local aGrdBack3 := { { 1, oget:ownd:nClrPane, oget:ownd:nClrPane } }
DEFAULT lRounded := .f.
DEFAULT lfocus := .t.
if lFocus
hPen1 = CreatePen( PS_SOLID, 1, nRGB( 102 , 175, 233 ) )
else
hPen1 = CreatePen( PS_SOLID, 1, nRGB( 180 , 180, 180 ) )
endif
SelectObject( hDC,hPen1)
aTopLeft = ClientToScreen( oGet:hWnd, { aRect[1], aRect[2] } )
aTopLeft = ScreenToClient( oGet:oWnd:hWnd, aTopLeft )
aBottomRight = ClientToScreen( oGet:hWnd, {aRect[3], aRect[4] } )
aBottomRight = ScreenToClient( oGet:oWnd:hWnd, aBottomRight )
SetBkMode( hDC , 1 )
GRADIENTFILL( hDC, aTopLeft[1]-12, aTopLeft[2]-12, aTopLeft[1]-3, aBottomRight[ 2 ]+12 , if( lFocus, aGrdBack1, aGrdBack3 ) )
GRADIENTFILL( hDC, aBottomRight[1]+2, aTopLeft[2]-10, aBottomRight[1]+10, aBottomRight[ 2 ]+10 , if( lFocus, aGrdBack2, aGrdBack3 ) )
GRADIENTFILL( hDC, aTopLeft[1]-5, aTopLeft[2]-14, aBottomRight[1]+5, aTopLeft[ 2 ]-3 ,if( lFocus, aGrdBack1, aGrdBack3 ), .F. )
GRADIENTFILL( hDC, aTopLeft[1]-5, aBottomRight[2]+2, aBottomRight[1]+5, aBottomRight[ 2 ]+14 , if( lFocus, aGrdBack2, aGrdBack3 ), .F. )
if lRounded
RoundRect( hDC, aTopLeft[2]-4, aTopLeft[1]-2, aBottomRight[ 2 ]+3, aBottomRight[ 1 ]+2 , 7, 7 )
else
Rectangle( hDC, aTopLeft[1]-2, aTopLeft[2]-2, aBottomRight[ 1 ]+2, aBottomRight[ 2 ]+2 )
endif
DeleteObject( hpen1 )
oGet:oWnd:ReleaseDC()
Return nil
/*
Desde recursos tendríamos que cambiar la táctica ... dos cosas :
1.- el marco en redondo produce un efecto raro ( no se si se puede hacer redondo el original )
2.- en vez usar el bpaint tendriamos que usar ...
//oget:bPainted = { || LightBorder2( oGet2, oGet2:lFocused , .T. ) }
oget:bgotfocus = { || LightBorder( oGet,.t., .f. ) }
oget:bLostFocus = { || LightBorder( oGet,.f., .f. ) }
ACTIVATE DIALOG oDlg CENTERED ON Paint LightBorder ( oGet,.t., .f. ) // aqui ponemos esto si es el get el primer control que toma el foco cunado se lanza el dialogo
*/