FUNCTION SHOW_BROW()
LOCAL hBrush1 := CreateSolidBrush( nObjColor )
@ 60, 55 XBROWSE oBrw1 SIZE 730, 601 PIXEL OF oDlg1 ;
AUTOCOLS ARRAY aImg NOBORDER
oBrw1:lHeader := .F.
oBrw1:lFooter := .F.
oBrw1:lRecordSelector := .F.
oBrw1:lHScroll := .F.
oBrw1:lVScroll := .F.
oBrw1:lAllowRowSizing := .F.
oBrw1:lAllowColSwapping := .F.
oBrw1:lContrastClr := .F.
oBrw1:nMarqueeStyle := 0
oBrw1:nRowDividerStyle := 1
oBrw1:nColDividerStyle := 1
FOR nCol := 1 to nSGet[3]
WITH OBJECT oBrw1:aCols[ nCol ]
:nWidth := nCellSize
:bPaintText := { | oCol, hDC, cData, aRect | DrawCell( oBrw1, oCol, hDC, cData, aRect, hBrush1 ) }
:lAllowSizing := .F.
END
NEXT
WITH OBJECT oBrw1
:nRowHeight := nCellSize
// Selected Row on Focus ( Text / Background )
// ------------------------------------------------------------
:bClrSelFocus = { || { , 16777215 } }
// Selected Row on LostFocus ( Text / Background )
// -----------------------------------------------------------------
:bClrSel = { || { 0, 16777215 } }
:bClrStd := {|| { 0, 16777215 } }
:bClrSelFocus = { || { 0, 16777215 } }
XBRW_BACK(oBrw1)
END
// DEFINE YOUR ACTION !!!
// ------------------------------
oBrw1:bLClicked := { | nRow, nCol | ( nRPos := oBrw1:KeyNo(), ;
nCPos := oBrw1:SelectedCol():nCreationOrder, ;
nRecPos1 := ( ( nRPos - 1 )* nSGet[3] ) + nCPos, ;
IIF( ALLTRIM(aImg[ nRPos, nCPos ]) <> ALLTRIM(c_path1 + cImages[17]) , ;
( SOUND_PLAY(3), MsgAlert( "Selected Image !" + CRLF + "Please hide the Preview !", "Error" ) ), ;
( nSelect++, ;
aImg[ nRPos, nCPos ] := c_path1 + cCards[nRecPos1], ;
IIF( nSelect = 1, ( nRPos1 := nRPos, nCPos1 := nCPos ), NIL ), ;
IIF( nSelect = 2, ( nRPos2 := nRPos, nCPos2 := nCPos ), NIL ), ;
SET_POINTS() ) ) ) }
oBrw1:CreateFromCode()
RETURN NIL
//----------------------------------------------------------------------------//
STATIC FUNCTION DrawCell ( oBrw1, oCol, hDC, cData, aRect, hBrush1 )
LOCAL oBrw := oCol:oBrw
LOCAL nTop := aRect[ 1 ]
LOCAL nLeft := aRect[ 2 ]
LOCAL nBottom := aRect[ 3 ]
LOCAL nRight := aRect[ 4 ]
LOCAL nOld, nOld1, lAlpha, nZeroClr
LOCAL hBmp, hBmpO, nBmpW, nBmpH, nBmpTop, nBmpLeft
LOCAL oBold, oItalic
DEFINE FONT oBold NAME 'TAHOMA' SIZE 0,-18 BOLD
DEFINE FONT oItalic NAME 'TAHOMA' SIZE 0,-18 ITALIC
IF ! Empty( cData := oCol:Value() ) // note: cData is reassigned
hBmp := FILoadImg( cData )
nBmpH := nCellSize
nBmpW := nCellSize + 2
nBmpTop := nTop - 2
nBmpLeft := nLeft - 4
lAlpha := HasAlpha( hBmp )
IF lAlpha .or. ! oCol:lBmpTransparent
hBmpO := hBmp
hBmp := ResizeImg( hBmpO, nBmpW, nBmpH )
DeleteObject( hBmpO )
ENDIF
IF lAlpha
ABPaint( hDC, nBmpLeft, nBmpTop, hBmp, oCol:nAlphaLevel(255) )
ELSEIF oCol:lBmpTransparent
nZeroClr := GetZeroZeroClr( hDC, hBmp )
TransBmp( hBmp, nBmpWidth( hBmp ), nBmpHeight( hBmp ),;
nZeroClr, hDC, nBmpLeft, nBmpTop, nBmpW, nBmpH )
ELSE
DrawBitmap( hDC, hBmp, nBmpTop, nBmpLeft )
ENDIF
// --------------------
// --------------------
DRAWTEXT( oCol, hDC, oBrw1, cFileNoPath(cData), aRect, oBold, oItalic )
// --------------------
// --------------------
DeleteObject( hBmp )
DeleteObject( hBrush1)
ENDIF
RELEASE FONT oBold
RELEASE FONT oItalic
RETURN NIL
//----------------------------------------------------------------------------//
STATIC FUNCTION GetZeroZeroClr( hDC, hBmp )
LOCAL hDCMem, hOldBmp, nZeroZeroClr
hDCMem = CreateCompatibleDC( hDC )
hOldBmp = SelectObject( hDCMem, hBmp )
nZeroZeroClr = GetPixel( hDCMem,0,0)
SelectObject( hDCMem, hOldBmp )
DeleteDC( hDCMem )
RETURN nZerozeroClr
//----------------------------------------------------------------------------//
STATIC FUNCTION DRAWTEXT( oCol, hDC, oBrw1, cText, aCoord, oBold, oItalic )
local nTop := aCoord[ 1 ], nLeft := aCoord[ 2 ]
local nBottom := aCoord[ 3 ], nRight := aCoord[ 4 ]
local nRow := nTop
local cLine, nFontHt, nAt
nAt := AT( CRLF, cText )
IF nAt > 0
cLine := Left( cText, nAt - 1 )
oBold:Activate( hDC )
nFontHt := GetTextHeight( oCol:oBrw:hWnd, hDC )
DRAWTEXTEX( hDC, cLine, { nRow, nLeft, nRow + nFontHt + 4, nRight }, 1 ) //oCol:nDataStyle )
oBold:DeActivate( hDC )
nRow += nFontHt + 4
cLine := SubStr( cText, nAt + 2 )
ELSE
cLine := cText
ENDIF
IF oBrw1:KeyNo() = 2 .or. oBrw1:KeyNo() = 4
SetTextColor( hDC, 255 )
ELSE
SetTextColor( hDC, 0 )
ENDIF
oItalic:Activate( hDC )
DRAWTEXTEX( hDC, cLine, { nRow, nLeft, nBottom, nRight }, oCol:nDataStyle )
oItalic:DeActivate( hDC )
RETURN NIL