Rezise Bitmaps
Posted: Mon Jan 26, 2009 7:19 pm
HOe I can resize a bitmap and Know his height and with to insert a prompt text ?
www.FiveTechSoft.com
https://fivetechsupport.com/forums/
Code: Select all | Expand
//------------- RESIZE BMP with GRADIENT HOR / VERT -----------
// GRADIENT-BMP
// ---- only repainted if any Slider ( Horiz. or Vertical )- changed ----
REDEFINE BITMAP oBmp ID 130 ADJUST RESOURCE "Blanc" OF oFld:aDialogs[3]
oBmp:bPainted := { |hDC| IIF( lHORZ = .T. .or. lVERT = .T., ;
( NEW_SIZE( oBMP ),lHORZ = .F., lVERT = .F. ), NIL ) }
// ----------------- Horizont-Slider ---------------------
REDEFINE SLIDER oSLIDER3 VAR nGRADHORZ OF oFld:aDialogs[3] ID 710;
HORIZONTAL ;
RIGHT DIRECTION ;
RANGE 0, 100 ;
ON CHANGE ( lHORZ := .T., lVERT:= .T., ;
oGRADHORZ:Refresh(), ;
nHORZ := 6.2 * nGRADHORZ, ;
oBMP:nWidth() := nHORZ, ;
oBMP:Refresh() ) ;
COLORS 128, 15977281, 128 ;
MARKS 49 ;
UPDATE
// % - Field
// ---------
REDEFINE GET oGRADHORZ VAR nGRADHORZ ID 715 PICTURE "999" OF oFld:aDialogs[3] UPDATE ;
VALID ( ( oGRADHORZ:Refresh(), oSlider3:Set(nGRADHORZ ), oSlider3:Refresh(), ;
nHORZ := 6.2 * nGRADHORZ, ;
oBMP:nWidth() := nHORZ, ;
oBMP:Refresh() ), .T. )
// ----------------- Vertical-Slider ---------------------
REDEFINE SLIDER oSLIDER4 VAR nGRADVERT OF oFld:aDialogs[3] ID 700;
VERTICAL ;
RIGHT DIRECTION ;
RANGE 0, 100 ;
ON CHANGE ( lHORZ := .T., lVERT:= .T., ;
oGRADVERT:Refresh(), ;
nVERT := 4.9 * nGRADVERT, ;
oBMP:nHeight() := nVERT, ;
oBMP:Refresh() ) ;
COLORS 128, 15977281, 128 ;
MARKS 49 ;
UPDATE
REDEFINE GET oGRADVERT VAR nGRADVERT ID 705 PICTURE "999" OF oFld:aDialogs[3] UPDATE ;
VALID ( ( oGRADVERT:Refresh(), oSlider4:Set(nGRADVERT), oSlider4:Refresh(), ;
nVERT := 4.9 * nGRADVERT, ;
oBMP:nHeight() := nVERT, ;
oBMP:Refresh() ), .T. )
////////////////////////
FUNCTION NEW_SIZE( oBitmap )
LOCAL hDC := oBitmap:GETDC()
// Both doing the same
// ------------------------
oBitmap:SetSize( nHORZ, nVERT )
*PalBmpDraw( hDC, 0, 0, oBitmap:hBitmap, , nVERT, nHORZ )
//aGrad and nDirection are defined !!!
// nMove = 2. Color start-position ( in this sample < 0.50 > centered )
// nVColor = 1. Color
// nBColor = 2. Color
// nDirection : 1 = Horiz., 2 = Vert.
// -------------------------------------
// aGrad := { { nMove, nVColor, nBColor }, ;
// { nMove, nBColor, nVColor } }
IF nDirection = 1
GradientFill( hDC,0,0, nVERT, nHORZ, aGrad, .T. )
ELSE
GradientFill( hDC,0,0, nVERT, nHORZ, aGrad, .F. )
ENDIF
oBitmap:ReleaseDC()
RETURN NIL