when i resize the window and still the same controls contained in the tpanel ?
I create the Panel with
- Code: Select all Expand view RUN
#include "fivewin.ch"
function Main()
local oWnd,oPanel
DEFINE WINDOW oWnd
oPanel:= CreatePanel(oWnd,10,10,CLR_WHITE,CLR_HGRAY,200,200,.t.)
oPanel:bPainted := { || MyControls(oPanel) }
ACTIVATE WINDOW oWND
return nil
//-----------------------------------------------------------------------------//
Function CreatePanel(oWnd,nRow,nLeft,nColor1,nColor2,nBottom,nWidth,lBorder)
local oPanel,oBrush
local aGrad := { nColor1,nColor2}
DEFAULT lBorder:=.f.
DEFINE BRUSH oBrush GRADIENT aGrad
oPanel:=Tpanel():New( nRow, nLeft, nBottom, nWidth, oWnd)
oPanel:SetBrush( oBrush )
IF lBorder
oPanel:bPainted := { || oPanel:Box( 1,1,oPanel:nHeight-1,oPanel:nWidth-1 ) }
Endif
return oPanel
//-----------------------------------------------------------//
Function MyControls(oPanel)
local rc := GetClientRect(oPanel:hWnd)
local hDc:=oPanel:getdc()
local nTop := rc[1]
local nLeft := rc[2]
local nBottom := rc[3]
local nRight := rc[4]
LOCAL oFont := TFont():New("Tahoma" , 0, 40,, )
Linea( hDc, nTop+48, nLeft+5, 0.5, nRight-11, CLR_HGRAY )
PaintTEXT(nTop+60,nLeft,nBottom,nRight,hdc,"fivetech",CLR_RED,oFont)
return nil
//-----------------------------------------------------------//
static function Linea( hDC, nTop, nLeft, nBottom, nRight, nColor, nWidth )
local hPen, hOldPen
DEFAULT nColor := CLR_BLACK, nWidth := 1
hPen = CreatePen( PS_SOLID, nWidth, nColor )
hOldPen = SelectObject( hDC, hPen )
MoveTo( hDC, nLeft, nTop )
LineTo( hDC, nRight, nTop )
SelectObject( hDC, hOldPen )
DeleteObject( hPen )
return 0
Function PaintTEXT(nTop,nLeft,nBottom,nRight,hdc,ctext,ncolor1,oFont)
local hFont, hOldFont
local nOldMode,ncolor
hFont := oFont:hFont
hOldFont := SelectObject( hDC, hFont )
nOldMode := SetBkMode( hDC, 1 ) //transparent
nColor := SetTextColor( hDC, nColor1)
nLeft += 8
DrawTextEx( hDC, cText , {nTop+2,nLeft,nBottom,nRight} )
SetBkMode( hDC, nOldMode )
SelectObject( hDC, hOldFont )
SetTextColor( hDC, nColor )
DeleteObject( hFont )
return nil
but on my application I use a tscrollpanel instead of the window