Hello!
How to draw a box - border around
current/focused line in TWBrowse.
Thanks, Roman
case nLineStyle == LINES_GRAY
hPen = CreatePen( PS_SOLID, 1, CLR_GRAY )
hOld = SelectObject( hDC, hPen )
MoveTo( hDC, nLeft - 2, nTop - 2 )
LineTo( hDC, nLeft - 2, nBottom )
LineTo( hDC, nRight , nBottom )
SelectObject( hDC, hOld )
DeleteObject( hPen )
case nLineStyle == LINES_GRAY
hPen = CreatePen( PS_SOLID, 1, CLR_GRAY )
hOld = SelectObject( hDC, hPen )
MoveTo( hDC, nLeft - 2, nTop - 1 )
LineTo( hDC, nLeft - 2, nBottom )
LineTo( hDC, nRight , nBottom )
MoveTo( hDC, nLeft - 2, nTop - 1 )
LineTo( hDC, nRight , nTop - 1 )
SelectObject( hDC, hOld )
DeleteObject( hPen )
hPen = CreatePen( PS_SOLID, 1, CLR_WHITE )
hOld = SelectObject( hDC, hPen )
MoveTo( hDC, nLeft - 1, nTop )
LineTo( hDC, nLeft - 1, nBottom )
SelectObject( hDC, hOld )
DeleteObject( hPen )
**************************************************************************
static function wBrwSimple( hWnd, hDC, nRowPos, aValues, aColSizes,;
nColPos, nClrText, nClrPane,;
hFont, lTree, aJustify, nPressed, nLineStyle,;
nColAct, lFocused, oVScroll, bLogicLen )
**************************************************************************
local nTxtHeight, hOldFont
local nColStart := -1
local nWidth := WndWidth( hWnd ) - If( oVScroll != nil .and. ;
Eval( bLogicLen ) > 1,;
GetSysMetrics( SM_CYHSCROLL ) + 3, 0 )
local nRow := nRowPos, nTop, nBottom, nLeft, nRight, n
local lReleaseDC := .f.
local nForeColor, nBackColor
local hPen, hOld, hBrush
DEFAULT lTree := .f.
if Empty( hDC )
hDC = GetDC( hWnd )
lReleaseDC = .t.
endif
hOldFont = SelectObject( hDC, hFont )
nTxtHeight = GetTextHeight( hWnd, hDC ) + 1
nTop = nTxtHeight * nRow
nBottom = nTop + nTxtHeight - 1
for n := nColPos to Len( aValues )
nLeft = nColStart + 1
nRight = Min( nColStart := ( nLeft + aColSizes[ n ] - 1 ), nWidth )
if nLeft > nWidth
exit
endif
if n == Len( aValues )
nRight = nWidth
endif
if lFocused
hPen = CreatePen( PS_SOLID, 1, CLR_BLACK )
hOld = SelectObject( hDC, hPen )
MoveTo( hDC, nLeft-1 , nBottom-1 )
LineTo( hDC, nRight, nBottom-1 )
MoveTo( hDC, nRight-1, nTop )
LineTo( hDC, nLeft-2 , nTop )
SelectObject( hDC, hOld )
DeleteObject( hPen )
else
hPen = CreatePen( PS_DOT, 1, CLR_BLACK )
hOld = SelectObject( hDC, hPen )
MoveTo( hDC, nLeft-1 , nBottom )
LineTo( hDC, nRight, nBottom )
MoveTo( hDC, nRight-1, nTop-1 )
LineTo( hDC, nLeft-2 , nTop-1 )
SelectObject( hDC, hOld )
DeleteObject( hPen )
endif
if nColPos > nWidth
exit
endif
next
return NIL // wBrwSimple
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 68 guests