Moderator: Enrico Maria Giordano
function NuovoRB()
local oWndChild, oBar, oBmp
LOCAL KMTotali,KMParziali,Titolo,Note1,Note2
LOCAL oGet1
DEFINE WINDOW oWndChild MDICHILD COLOR "N/W" of oWnd;
title "Nuovo RoadBook"
DEFINE BUTTONBAR oBar 3D SIZE 25, 25 OF oWndChild
DEFINE BUTTON OF oBar ACTION PutLabel( oBmp ) TOOLTIP "Testo"
DEFINE BUTTON OF oBar ACTION PutBitmap( oBmp ) TOOLTIP "Simboli"
DEFINE BUTTON OF oBar ACTION PreView( oBmp ) TOOLTIP "Anteprima di stampa"
// titolo
@ 2,0 get oGet1 VAR Note1 MEMO SIZE 700, 100 OF oWndChild
//Linea
@ 10,2 say "KM TOTALI" SIZE 80, 50 OF oWndChild
@ 14,2 say "KM PARZIALI" SIZE 80, 50 OF oWndChild
@ 10,10 get oGet2 VAR KMTotali SIZE 80, 50 OF oWndChild
@ 14,10 get oGet2 VAR KMParziali SIZE 80, 50 OF oWndChild
@ 10,20 BITMAP oBmp SIZE 200, 100 OF oWndChild
oBmp:bPainted = { | hDC | DrawSections( hDC ) }
* oBmp:oHScroll:SetRange( 1, 1200 )
* oBmp:oHScroll:nPgStep = 20
oWndChild:SetControl( oBmp )
ACTIVATE WINDOW oWndChild
function DrawSections( hDC )
local oBrWhite, oBrCyan
DEFINE BRUSH oBrWhite COLOR CLR_WHITE
DEFINE BRUSH oBrCyan COLOR CLR_YELLOW
* FillRect( hDC, { 10, 20, 100, 641 }, oBrWhite:hBrush )
*FillRect( hDC, { 100, 50, 150, 641 }, oBrCyan:hBrush )
* FillRect( hDC, { 150, 0, 200, 641 }, oBrWhite:hBrush )
oBrWhite:End()
oBrCyan:End()
METHOD Paint() CLASS TTabs
local aInfo := ::DispBegin()
local hDarkPen := CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNSHADOW ) )
local hGrayPen := CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNFACE ) )
local hLightPen := CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNHIGHLIGHT ) )
local n, nCol := 5, nHeight := 15
local hOldFont, hOldBrush, hOldPen
local hDC := ::hDC
local hGrayBrush := CreateSolidBrush( ::nClrPane )
local hDarkBrush := CreateSolidBrush( GetSysColor( COLOR_INACTIVECAPTION ) )
local lNeedButtons := .f.
if LargeFonts()
nHeight += 3
endif
FillRect( ::hDC, GetClientRect( ::hWnd ), ::oBrush:hBrush )
hOldFont = SelectObject( hDC, ::oFont:hFont )
hOldPen = SelectObject( hDC, hDarkPen )
hOldBrush = SelectObject( hDC, hDarkBrush )
MoveTo( hDC, 0, 0 )
LineTo( hDC, ::nWidth(), 0 )
SetBlackPen( hDC )
MoveTo( hDC, 0, 1 )
LineTo( hDC, ::nWidth(), 1 )
SetTextColor( hDC, CLR_WHITE )
if Len( ::aSizes ) < Len( ::aPrompts )
::Default()
endif
DEFAULT ::nOffset := 1
for n = ::nOffset to Len( ::aPrompts )
SelectObject( hDC, If( n == ::nOption, hGrayBrush, hDarkBrush ) )
SetBlackPen( hDC )
if n == ::nOffset .or. n == ::nOption
PolyPolygon( hDC, { { nCol, 1 },;
{ nCol + 5, nHeight },;
{ nCol + 9 + ::aSizes[ n ], nHeight },;
{ nCol + 14 + ::aSizes[ n ], 1 },;
{ nCol, 1 } } )
else
PolyPolygon( hDC, { { nCol + 2, 7 },;
{ nCol + 5, nHeight },;
{ nCol + 9 + ::aSizes[ n ], nHeight },;
{ nCol + 14 + ::aSizes[ n ], 1 },;
{ nCol + 4, 1 },;
{ nCol + 2, 7 } } )
endif
if n == ::nOption
SelectObject( hDC, hGrayPen )
MoveTo( hDC, nCol, 0 )
LineTo( hDC, nCol + 14 + ::aSizes[ n ], 0 )
MoveTo( hDC, nCol + 1, 1 )
LineTo( hDC, nCol + 14 + ::aSizes[ n ], 1 )
SelectObject( hDC, hLightPen )
MoveTo( hDC, nCol + 1, 2 )
LineTo( hDC, nCol + 6, nHeight - 1 )
SelectObject( hDC, hDarkPen )
LineTo( hDC, nCol + ::aSizes[ n ] + 8, nHeight - 1 )
LineTo( hDC, nCol + ::aSizes[ n ] + 13, 0 )
SetTextColor( hDC, ::nClrText )
SetBkColor( hDC, ::nClrPane )
DrawText( hDC, ::aPrompts[ n ],;
{ 1, nCol + 4, 15, nCol + 5 + ::aSizes[ n ] + 5 },;
nOr( DT_CENTER, DT_VCENTER ) )
else
SetTextColor( hDC, GetSysColor( COLOR_INACTIVECAPTIONTEXT ) )
SetBkColor( hDC, GetSysColor( COLOR_INACTIVECAPTION ) )
DrawText( hDC, ::aPrompts[ n ],;
{ 2, nCol + 3, 19, nCol + 5 + ::aSizes[ n ] + 6 },;
nOr( DT_CENTER, DT_VCENTER ) )
endif
nCol += ::aSizes[ n ] + 4 + 6
if ( nCol ) > ::nWidth
lNeedButtons := .t.
exit
endif
next
if ! Empty( ::oBtnLeft )
if ::nOffset > 1 .or. lNeedButtons
::oBtnLeft:Move( 4, ::nWidth - 24, 11, 15, .t. )
::oBtnRight:Move( 4, ::nWidth - 25 + 12, 11, 15, .t. )
::oBtnLeft:Show()
::oBtnRight:Show()
::oBtnLeft:Paint()
::oBtnRight:Paint()
if ::nOffset > 1
::oBtnLeft:Enable()
else
::oBtnLeft:Disable()
endif
if ! lNeedButtons
::oBtnRight:Disable()
else
::oBtnRight:Enable()
endif
else
::oBtnLeft:Hide()
::oBtnRight:Hide()
endif
endif
SelectObject( hDC, hOldPen )
SelectObject( hDC, hOldFont )
SelectObject( hDC, hOldBrush )
DeleteObject( hDarkPen )
DeleteObject( hGrayPen )
DeleteObject( hLightPen )
DeleteObject( hDarkBrush )
DeleteObject( hGrayBrush )
::DispEnd( aInfo )
return nil
Silvio wrote:si ma Linares mi ha detto di creare un user control
Anche a me mi sembra la soluzione giusta
Silvio wrote:cioè dovrei disegnare questo inizialmente
[img=http://img387.imageshack.us/img387/1993/linearoadb2ah.png]
Silvio wrote:mi daresti solo una dritta a disegnare il rettangolo , e il bitmap in mezzo
Function DrawLine( hDC, x, y , high, widht, color)
LOCAL n, hPen, hOldPen
hPen := CreatePen( 0, 2, color )
hOldPen := SelectObject( hDc, hPen )
MoveTo( hDC, y, x )
LineTo( hDC, widht, high)
SelectObject( hDc, hOldPen )
DeleteObject( hPen )
return NIL
Silvio wrote:con questo metodo sarebbe più facile a disegnare ste linee
DrawLine( hDC, 0, 0 , 0,100,CLR_BLACK) peresempio
Silvio wrote:Adesso però ho un problema
per intenderci la classe tab disegna il suo controllo in fondo mentre io voglio disegnarlo sopra dove è l'istruzione che fa questo ?
Silvio wrote:HAI RICEVUTO I FILES ?
Return to All products support
Users browsing this forum: No registered users and 4 guests