by FranciscoA » Thu Aug 18, 2011 4:33 am
Goosfancito, aquí tienes un ejemplo probado: (Entorno MDI)
//----------------------------//
Function Prueba()
local oChild, oBrw, oFont1, oBotModi
local dFechemis := cTod(" / / "), oFechemis
Local oConceptG, cConceptG:="ESTO ES UNA PRUEBA"
LOCAL oRect, oRectClr1, oRectClr2, nRectClrTxt1,nRectClrTxt2
oRectClr1:= 12961221
oRectClr2:= 16777215
nRectClrTxt1:=0
nRectClrTxt2:=0
DEFINE FONT oFont1 NAME "LUCIDA SANS TYPEWRITER" SIZE 6, -13
DEFINE WINDOW oChild MDICHILD OF oWnd TITLE "Prueba"
oRect:=TRectang():New( 0, 0, 130, oChild:nWidth, oChild ,, oRectClr1,oRectClr2, )
oRect:bPainted:={|| oRect:nWidth := oChild:nWidth ,;
oRect:Say( 15, 48, "Fecha de Emision:", nRectClrTxt1, nRectClrTxt2, oRect:oWnd:oFont, .T., .T.,) ,;
oRect:Say( 40, 48, "Concepto General:", nRectClrTxt1, nRectClrTxt2, oRect:oWnd:oFont, .T., .T.,) }
@1.0, 28 GET oFechemis VAR dFechemis OF oRect SIZE 90,18 FONT oWnd:oFont
@2.7, 28 GET oConceptG VAR cConceptG OF oRect SIZE 550,68 MULTILINE NO VSCROL FONT oFont1
@70,30 BTNBMP oBotModi LEFT 2007 PROMPT "Modificar" SIZE 100,28 OF oRect ACTION MsgInfo("Hola")
oBotModi:cTooltip := "Modificar el documento"
oBrw := TXBrowse():New( oChild )
oBrw:CreateFromCode()
ACTIVATE WINDOW oChild MAXIMIZED;
ON INIT ( oFechemis:SetFocus(),;
oBrw:nHeight := oChild:nHeight-163, oBrw:nWidth := oChild:nWidth-12, oBrw:nTop:=130 )
oFont1:End()
RETURN NIL
Y ésta es la Classe:
#include "FiveWin.ch"
#define COLOR_BTNFACE 15
#ifdef __XPP__
#define Super ::TControl
#endif
// Francisco J. Alegría P., Sept 10/2008
//----------------------------------------------------------------------------//
CLASS TRectang FROM TControl
DATA l3D
DATA nRGB1, nRGB2
CLASSDATA lRegistered AS LOGICAL
METHOD New( nRow, nCol, nHeight, nWidth, oWnd, l3D, nRGB1, nRGB2, oFont ) CONSTRUCTOR
METHOD Display() INLINE ::BeginPaint(), ::Paint(), ::EndPaint(), 0
METHOD Paint()
ENDCLASS
//----------------------------------------------------------------------------//
METHOD New( nRow, nCol, nHeight, nWidth, oWnd, l3D, nRGB1, nRGB2, oFont ) CLASS TRectang
local oRect := oWnd:GetCliRect()
DEFAULT nWidth:=100, nHeight:=oWnd:nHeight, l3D := .f.,;
nRGB1:=NIL, nRGB2:=NIL, oFont:= NIL
::nStyle = nOR( WS_CHILD, WS_VISIBLE, WS_CLIPCHILDREN )
::oWnd = oWnd
::nTop = nRow
::nLeft = nCol
::nBottom = nHeight
::nRight = nWidth
::l3D = l3D
::nClrPane = If( l3D, GetSysColor( COLOR_BTNFACE ), CLR_GRAY )
::nRGB1 = nRGB1
::nRGB2 = nRGB2
::oFont = oFont
#ifdef __XPP__
DEFAULT ::lRegistered := .f.
#endif
::SetColor( ::nClrText, ::nClrPane )
::Register( nOR( CS_VREDRAW, CS_HREDRAW ) )
::Create()
return Self
//----------------------------------------------------------------------------//
METHOD Paint() CLASS TRectang
local aInfo := ::DispBegin(), oFont
//colores personalizados degradados
Gradient( ::hDC, { 0, 0, ::nHeight, ::nWidth },;
::nRGB1, ::nRGB2, .T. )
if ::oFont == nil
DEFINE FONT oFont NAME "Tahoma" SIZE 0, -12 BOLD
endif
::oWnd:SetFont( oFont )
if ::bPainted != nil
Eval( ::bPainted, ::hDC )
endif
::oWnd:oFont:End()
::DispEnd( aInfo )
return nil
Espero sea de alguna utilidad.
Saludos
Francisco J. Alegría P.
Chinandega, Nicaragua.
Fwxh-MySql-TMySql