Aún hay que ajustar las esquinas de los botones, pero la apariencia es muy buena
xbrpaint.prg
Code: Select all
// xbrowse advanced painting examples
#include "FiveWin.ch"
#include "xbrowse.ch"
#define CLR_BACK nRGB( 130, 201, 249 )
function Main()
local oWnd, oFont, oBrw, aItems := { { "One", "Two" }, { "Three", "Four" }, { "Five", "Six" } }
local hBmp := ReadBitmap( 0, "..\bitmaps\contact.bmp" )
DEFINE FONT oFont NAME "Segoe UI Light" SIZE 0, -16
DEFINE WINDOW oWnd COLOR "BG/B" STYLE nOr( WS_POPUP, WS_VISIBLE )
@ 9, 37 XBROWSE oBrw ARRAY aItems ;
SIZE 800, 500 NOBORDER OF oWnd FONT oFont
oBrw:nDataLines = 4
oBrw:lRecordSelector = .F.
oBrw:lHeader = .F.
oBrw:lHScroll = .F.
oBrw:lVScroll = .F.
oBrw:nMarqueeStyle = MARQSTYLE_HIGHLCELL // MARQSTYLE_NOMARQUEE
oBrw:bClrStd = { || { 0, CLR_BACK } }
oBrw:bClrSelFocus = { || { CLR_WHITE, CLR_BACK } }
oBrw:SetColor( 0, CLR_BACK )
oBrw:CreateFromCode()
oBrw:SetFocus()
oBrw:aCols[ 1 ]:nWidth = 400
oBrw:aCols[ 2 ]:nWidth = 400
oBrw:aCols[ 1 ]:bPaintText = { | oCol, hDC, cText, aCoors, aColors, lHighlight | DrawRow( oCol, hDC, cText, aCoors, oFont, lHighlight, hBmp ) }
oBrw:aCols[ 2 ]:bPaintText = { | oCol, hDC, cText, aCoors, aColors, lHighlight | DrawRow( oCol, hDC, cText, aCoors, oFont, lHighlight, hBmp ) }
ACTIVATE WINDOW oWnd MAXIMIZED ;
ON CLICK oWnd:End()
return nil
function DrawRow( oCol, hDC, cText, aCoors, oFont, lHighlight, hBmp )
local hOldFont, nOldMode := SetBkMode( hDC, 0 )
// local hRgn := CreateRoundRectRgn( { aCoors[ 1 ] + 10, aCoors[ 2 ] + 10, aCoors[ 3 ] - 10, aCoors[ 4 ] - 10 }, 10, 10 )
// SetWindowRgn( oCol:oBrw:hWnd, hRgn, .F. )
if lHighlight
GradientFill( hDC, aCoors[ 1 ] + 10, aCoors[ 2 ] + 10, aCoors[ 3 ] - 10, aCoors[ 4 ] - 10, { ;
{ 2/5, nRGB( 253, 212, 168 ), nRGB( 251, 178, 99 ) },;
{ 3/5, nRGB( 250, 157, 52 ), nRGB( 252, 234, 163 ) } } )
RoundBox( hDC, aCoors[ 2 ] + 10, aCoors[ 1 ] + 10, aCoors[ 4 ] - 10, aCoors[ 3 ] - 10, 20, 20, CLR_BLUE )
else
GradientFill( hDC, aCoors[ 1 ] + 10, aCoors[ 2 ] + 10, aCoors[ 3 ] - 10, aCoors[ 4 ] - 10, { ;
{ 2/5, nRGB( 223, 236, 255 ), nRGB( 197, 222, 255 ) },;
{ 3/5, nRGB( 173, 209, 255 ), nRGB( 189, 217, 255 ) } } )
RoundBox( hDC, aCoors[ 2 ] + 10, aCoors[ 1 ] + 10, aCoors[ 4 ] - 10, aCoors[ 3 ] - 10, 20, 20, CLR_BLUE )
endif
// DeleteObject( hRgn )
// SetWindowRgn( oCol:oBrw:hWnd, nil, .F. )
DrawBitmap( hDC, hBmp, aCoors[ 1 ] + 18, aCoors[ 2 ] + 23 )
aCoors[ 1 ] += 30
aCoors[ 2 ] += 80
DrawText( hDC, cText, aCoors )
hOldFont = SelectObject( hDC, oFont:hFont )
SetBkMode( hDC, nOldMode )
// DrawText( hDC, aItems[ oCol:oBrw:KeyNo ], aCoors )
// SelectObject( hDC, hOldFont )
return nil