RAMESHBABU wrote:Mr.Murugosa,
Please check your inbox.
- Ramesh babu P
DEFINE DIALOG oDlg........
.
dlg_brush(oDlg,CLR_BLUE,CLR_HBLUE)
.
ACTIVATE oDlg
//--------------------------------------------------------
function dlg_brush(oDlg,nColorTop,nColorBottom)
local oDlg_temp,oBr,nWidth,nHeight,cRes := "",cFile:= "back.bmp"
DEFAULT nColorTop := nRGB( 219, 230, 244 ) , nColorBottom := nRGB( 207, 221, 239 )
if !empty(oDlg)
cRes := oDlg:cResName
if !empty(cRes)
cFile:= cRes+"_back.bmp"
DEFINE DIALOG oDlg_temp RESOURCE cRes
ACTIVATE DIALOG oDlg_temp ;
ON INIT ;
(oDlg_temp:hide(),;
nHeight := oDlg_temp:nHeight(),;
nWidth := 1,; //oDlg_temp:nWidth(),;
oDlg_temp:end())
else
nHeight := oDlg:nBottom
nWidth := 1
endif
DEFINE DIALOG oDlg_temp FROM 0,0 TO nHeight,nWidth PIXEL STYLE nOr(WS_POPUP,4)
ACTIVATE DIALOG oDlg_temp ;
ON PAINT ;
(GradientFill( oDlg_temp:hDC, 0, 0, oDlg_temp:nHeight(), oDlg_temp:nWidth(), {{ 1,nColorTop,nColorBottom}} ),;
oDlg_temp:SaveToBmp(cFile),;
oDlg_temp:end())
if file( cFile )
DEFINE BRUSH oBr FILE cFile
oDlg:oBrush := oBr
ferase( cFile )
endif
endif
return NIL
//-------------------------------------------------------------
...
oBrushX := TBrushX():New ( ... )
DEFINE DIALOG ... BRUSH oBrushX
// ============================================================================
// CLASS TBrushX Version May 2008
// Authors: Stefan Haupt
// Silvio Falconi
// you can freely use this class, please don´t remove these lines
//============================================================================
// Erweiterte TBrush-Class für Brushes mit Gradient
// (Enhanced brush class to create brushes with a gradient)
// Parameter
// nColorFrom : Startfarbe bzw. Array {Startfarbe, Endfarbe} für oberen Gradient
// startcolor or array with start- endcolor for upper gradient
// nColorTo : Endfarbe bzw. Array {Startfarbe, Endfarbe} für unteren Gradient
// endcolor or array with start- endcolor for lower gradient
// lVGrad : .t. für vertikal, .f. für horizontal
// .t. for vertical, .f. for horizontal
// l2007 : Office-Look mit 2 Gradienten
// Look2007 with 2 gradients
//-----------------------------------------------------------------------------
#include "Fivewin.ch"
CLASS TBrushX FROM TBrush
METHOD New( nColor, nColor2, lVGrad ) //CONSTRUCTOR
ENDCLASS
METHOD New( nWidth, nHeight, nColorFrom, nColorTo, lVGrad, l2007 ) CLASS TBrushX
::lSystem = .f.
::hBitmap := CreateExtBrush (nWidth, nHeight, nColorFrom, nColorTo, lVGrad, l2007 )
::hBrush = If( ::hBitmap != 0, CreatePatternBrush( ::hBitmap ), )
::nCount := 1
AAdd( ::aBrushes, Self )
return Self
//-----------------------------------------------------------------//
FUNCTION CreateExtBrush ( nWidth, nHeight, nColorFrom, nColorTo, lVGrad, l2007 )
LOCAL hDC := CreateDC( "DISPLAY",0,0,0 )
LOCAL hDCMem := CreateCompatibleDC( hDC )
LOCAL hBmp := CreateCompatibleBitmap( hDC, nWidth, nHeight )
LOCAL hOldBmp := SelectObject( hDCMem, hBmp )
LOCAL aRC0 := {0,0,nHeight/2,nWidth}
LOCAL aRC := {nHeight/2,0,nHeight,nWidth}
LOCAL nClrUpperFrom, nClrLowerFrom, nClrUpperTo, nClrLowerTo
DEFAULT lVGrad := .t. // vertikaler Gradient (vertical gradient)
DEFAULT nColorTo := nColorFrom //
DEFAULT l2007 := .t. // Office-Look mit 2 Gradienten (Look2007 with 2 gradients)
IF Valtype (nColorFrom) == "A"
nClrUpperFrom := nColorFrom[1]
nClrUpperTo := nColorFrom[2]
ELSE
nClrUpperFrom := nColorFrom
nClrUpperTo := nColorFrom
ENDIF
IF Valtype (nColorTo) == "A"
nClrLowerFrom := nColorTo[1]
nClrLowerTo := nColorTo[2]
ELSE
nClrLowerFrom := nColorTo
nClrLowerTo := nColorTo
ENDIF
IF l2007
lVGrad := .t.
Gradient( hDCMem, {aRC0[1],aRC0[2],aRC0[3]+2,aRC0[4]}, nClrUpperFrom, nClrUpperTo, lVGrad )
Gradient( hDCMem, {aRC[1],aRC[2],aRC[3]+2,aRC[4]}, nClrLowerFrom, nClrLowerTo, lVGrad )
ELSE
Gradient( hDCMem, {0,0,nHeight,nWidth}, nClrUpperFrom, nClrLowerTo, lVGrad )
ENDIF
SelectObject( hDCMem, hOldBmp )
DeleteDC( hDCMem )
DeleteDC( hDC )
RETURN (hBmp)
//-------------------------------------------------------------------//
DLL32 FUNCTION CREATECOMPATIBLEBITMAP( hDC AS LONG,;
nWidth AS LONG,;
nHeight AS LONG) AS LONG;
PASCAL FROM "CreateCompatibleBitmap" LIB "gdi32.dll"
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 80 guests