// add new LOCALS !!!
LOCAL oNewbrush, nRow := 0, nCol := 0, nBmpHeight, nBmpWidth
..
// Back area
//
IF ! Empty( ::cBitmap ) .AND. File( AnsiToOem( Lfn2Sfn( ::cBitmap ) ) )
// keep the original BMP-structure !!!
// ------------------------------------------
DEFINE BITMAP oNewbrush FILENAME ::cBitmap
nHeight := oNewbrush:nHeight
nWidth := oNewbrush:nWidth
IF ::nWidth > 0
DO WHILE nRow < ::nHeight
nCol = 0
DO WHILE nCol < ::nWidth
PalBmpDraw( ::hDC, nRow, nCol, oNewbrush:hBitmap )
nCol += nHeight
ENDDO
nRow += nWidth
ENDDO
ENDIF
oNewbrush:End()
...
...
IF ::nDegrade = 1
nMid:=(nRight-nLeft)/2
Gradient( ::hDC, { nTop, nLeft, nBottom, nRight-nMid }, nColor, LightColor(175,nColor), .F. )
Gradient( ::hDC, { nTop, nLeft+nMid, nBottom, nRight }, LightColor(175,nColor), nColor, .F. )
ELSE
hBru = GradientBrush( ::hDC, 0, 0, 0, nTop, { { 0, nColor, LightColor(175,nColor) } }, .T. )
FillRect( ::hDC, { nTop, nLeft, nBottom, nRight }, hBru )
ENDIF
// Back area
//
IF ! Empty( ::cBitmap ) .OR. ( Empty( ::oPrn ) .AND. ::nType != GRAPH_TYPE_PIE )
IF UPPER ( ::cBitmap ) = "COLOR"
//MsgAlert( "Color" )
hBru := CreateSolidBrush( ::nClrBack )
hOld := SelectObject( ::hDC, hBru )
FillRect( ::hDC, { 0, 0, ::nHeight, ::nWidth }, hBru )
SelectObject( ::hDC, hOld )
DeleteObject( hBru )
ELSEIF UPPER ( ::cBitmap ) = "GRADIENT"
//MsgAlert( "Gradient" )
hBru := GradientBrush( ::hDC, 0, 0, ::nHeight, ::nWidth, ;
{ { 0, LightColor( 175, ::nClrBack ), ::nClrBack } }, .T. )
hOld := SelectObject( ::hDC, hBru )
FillRect( ::hDC,{ 0, 0, ::nHeight, ::nWidth }, hBru )
SelectObject( ::hDC, hOld )
DeleteObject( hBru )
ELSEIF File( ::cBitmap )
DEFINE BITMAP oNewbrush FILENAME ::cBitmap
nHeight := oNewbrush:nHeight
nWidth := oNewbrush:nWidth
IF ::nWidth > 0
DO WHILE nRow < ::nHeight
nCol = 0
DO WHILE nCol < ::nWidth
PalBmpDraw( ::hDC, nRow, nCol, oNewbrush:hBitmap )
nCol += nHeight
ENDDO
nRow += nWidth
ENDDO
ENDIF
oNewbrush:End()
ENDIF
ENDIF
hag wrote:Very cool. How would you accomplish the same if using resources?
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: MaxP and 73 guests