Cambio del tamaño de la imagen con thumbnails

Cambio del tamaño de la imagen con thumbnails

Postby J. Ernesto » Thu May 19, 2016 4:26 pm

Foro buenos días, esa es la pregunta, estoy probando un thumbnails con la clase txbrgrid que apareció publicada en este foro, y ahora se me hace necesario poder cambiar el tamaño de las imágenes.

¿Qué se modificar para lograrlo?

Gracias

Algún ejemplo funcional
J. Ernesto Pinto Q.
Fwh_x64 2407 + BCC++_x64 7_70__6_72 + Harbour 3.20 + LopeEdit 5.8 + UEstudio 26.0
jepsys@hotmail.com, jepsys@gmail.com, jepsys@yahoo.com
User avatar
J. Ernesto
 
Posts: 161
Joined: Tue Feb 03, 2009 10:08 pm
Location: Bogotá D.C. Colombia

Re: Cambio del tamaño de la imagen con thumbnails

Postby karinha » Thu May 19, 2016 5:57 pm

clase txbrgrid?? Donde la encuentro? Gracias.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7800
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Cambio del tamaño de la imagen con thumbnails

Postby J. Ernesto » Fri May 20, 2016 2:38 pm

Esta es la clase..

Code: Select all  Expand view

* Begin ========================================================================================================== *
* DERIVED CLASS
CLASS TXbrGrid FROM TXBrowse

 CLASSDATA lRegistered AS LOGICAL                                                                               && This is compulsory for derived classes
  DATA bColClass INIT { | | TXbGridCol () }

  DATA  nGridCols              INIT 1 PROTECTED
  DATA  hlGridView  AS LOGICAL INIT .F.
  DATA  nRows

  ACCESS lListview       INLINE     ( ! ::hlGridView )
  ASSIGN lListView ( l ) INLINE IIF (   ::hlGridView == l, ( ::hlGridview := ! l, ::ResetGridView (), ::Refresh () ), NIL )

  ACCESS lGridView       INLINE     (   ::hlGridView )
  ASSIGN lGridView ( l ) INLINE IIF (   ::hlGridView != l, ( ::hlGridView :=   l, ::ResetGridView (), ::Refresh () ), NIL )

  METHOD New      ( oWnd ) CONSTRUCTOR
  METHOD SetArray (  aData, lAutoSort, nColOrder, aCols )
  METHOD Adjust   ()
  METHOD Resize   ( nSizeType, nWidth, nHeight ) INLINE ( ::ResetGridView (), Super:ReSize ( nSizeType, nWidth * 2, nHeight * 2 ) )

PROTECTED:
  METHOD ResetGridView()

ENDCLASS
* ---------------------------------------------------------------------------------------------------------------- *

* ---------------------------------------------------------------------------------------------------------------- *
METHOD New( oWnd ) CLASS TXbrGrid

   Super:New( oWnd )

Return ( Self )
* ---------------------------------------------------------------------------------------------------------------- *

* ---------------------------------------------------------------------------------------------------------------- *
METHOD SetArray (  aData, lAutoSort, nColOrder, aCols ) CLASS TXbrGrid
Local nCols, n

IF VALTYPE ( aCols ) != "A"; aCols := NIL; ENDIF

Super:SetArray ( aData, .F., NIL, aCols )

 ::nRows     := LEN ( ::aArrayData )
 ::bKeyCount := { |             | ::nRows }
 ::bEof      := { |             | ::nArrayAt > ::nRows * ::nGridCols }
 ::bGoTop    := { |             | ::nArrayAt := 1 }
 ::bGoBottom := { |             | ::nArrayAt := ( ::nRows - 1 ) * ::nGridCols + 1 }
 ::bKeyCount := { |             | ::nRows }
 ::bSkip     := { | nSkip, nOld | IIF ( nSkip == NIL, nSkip := 1, ), ;
                                        nOld       := ::nArrayAt, ;
                                        ::nArrayAt += ::nGridCols * nSkip, ;
                                        ::nArrayAt := MAX ( 1, MIN ( ::nArrayAt, ::nRows * ::nGridCols - 3 ) ), ( ::nArrayAt - nOld ) / ::nGridCols }

 ::bBookMark       := ::bKeyNo := { | n | IIF ( n != NIL, ::nArrayAt := ( n - 1 ) * ::nGridCols + 1, NIL ), INT ( ( ::nArrayAt - 1 ) / ::nGridCols ) + 1 }

 nCols   := LEN ( ::aCols )
 AEval ( ::aCols, { | o | o:nArrayRow := 0 } )

Return ( Self )
* ---------------------------------------------------------------------------------------------------------------- *

* ---------------------------------------------------------------------------------------------------------------- *
METHOD Adjust () CLASs TXbrGrid
Local n

FOR n := 1 TO 10
 AddGridCols ( Self, LEN ( ::aCols ), n )
NEXT n

AEVAL ( ::aCols, { | o, i | o:nCreationOrder := i } )

Return Super:Adjust ()
* ---------------------------------------------------------------------------------------------------------------- *

* ---------------------------------------------------------------------------------------------------------------- *
Static Function AddGridCols ( oBrw, nCols, n )
Local nCol

FOR x := 1 TO nCols
 AADD ( oBrw:aCols, OClone ( oBrw:aCols [ x ] ) )
 
 WITH OBJECT ATAIL ( oBrw:aCols )
  :nArrayRow := n
  :lHide     := .T.
 END

NEXT x

Return ( NIL )
* ---------------------------------------------------------------------------------------------------------------- *

* ---------------------------------------------------------------------------------------------------------------- *
METHOD ResetGridview () CLASS TXbrGrid
Local nWidth := 0
Local nCols  := 0

AEVAL ( ::aCols, { | o | IIF ( EMPTY ( o:nArrayRow ), ( nCols ++, nWidth += o:nWidth ), NIL ) } )
nWidth += 3

IF ::hlGridView
 ::nGridCols := INT ( ( ::BrwWidth () - 2 ) / nWidth )
 ::nRows     := Ceiling ( LEN ( ::aArrayData ) / ::nGridCols )
 nCols       *= ::nGridCols

ELSE
 ::nGridCols := 1
 ::nRows     := LEN ( ::aArrayData )
ENDIF

AEVAL ( ::aCols, { | o, i | o:lHide := o:nCreationOrder > nCols } )
::GetDisplayCols ()
* ::Refresh ()

Return ( Self )
* End ============================================================================================================ *

* Begin ========================================================================================================== *
CLASS TXbGridCol FROM TXBrwColumn

 DATA nArrayRow INIT 0

 METHOD New    ( oBrw ) CONSTRUCTOR
 METHOD Adjust ()

ENDCLASS
* ---------------------------------------------------------------------------------------------------------------- *

* ---------------------------------------------------------------------------------------------------------------- *
METHOD New ( oBrw ) CLASS TXbGridCol

Super:New( oBrw )

Return ( Self )
* ---------------------------------------------------------------------------------------------------------------- *

* ---------------------------------------------------------------------------------------------------------------- *
METHOD Adjust () CLASS TXbGridCol
Local tmp

::bEditValue := { | x | IIF ( x == NIL, ::oBrw:ArrCell    ( ::oBrw:nArrayAt + ::nArrayRow, ::nArrayCol ),;
                                        ::oBrw:ArrCellSet ( ::oBrw:nArrayAt + ::nArrayRow, ::nArrayCol, x ) ) }

IF VALTYPE ( ::bBmpData ) == "N"
 tmp        := ::bBmpData
 ::bBmpData := { | | ::oBrw:aRow [ tmp ] }

ELSEIF ::bStrData == NIL .AND. ! ::hChecked
 ::bStrData := { | | ::oBrw:ArrCell ( ::oBrw:nArrayAt + ::nArrayRow, ::nArrayCol, ::cEditPicture, ::lDisplayZeros ) }
ENDIF

Return Super:Adjust ()
* End ============================================================================================================ *

* ---------------------------------------------------------------------------------------------------------------- *
*
*
*

 
J. Ernesto Pinto Q.
Fwh_x64 2407 + BCC++_x64 7_70__6_72 + Harbour 3.20 + LopeEdit 5.8 + UEstudio 26.0
jepsys@hotmail.com, jepsys@gmail.com, jepsys@yahoo.com
User avatar
J. Ernesto
 
Posts: 161
Joined: Tue Feb 03, 2009 10:08 pm
Location: Bogotá D.C. Colombia

Re: Cambio del tamaño de la imagen con thumbnails

Postby karinha » Fri May 20, 2016 2:44 pm

Tiens un ejemplo práctico/simples, para teste? gracias, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7800
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Cambio del tamaño de la imagen con thumbnails

Postby J. Ernesto » Tue May 24, 2016 2:04 pm

Este es un ejemplo tomado desde el foro

Code: Select all  Expand view

* -------------------------------------------------------------------------------------------------------------- *
Function Main ()
Local oWnd_BMP, oBar_BMP, oBrw_BMP, aData_BMP, oFont_12, oFont_16
Local n

Public  cPath
*Local sFileName := cGetFile ( "*.dbf"    , "Seleccione un archivo DBF", 1               , sDirName             ,  .T.   , .T.          ,          )
*Local sFileName := cGetFile ( "*.dbf"    , "Seleccione un archivo DBF", 1               , "\"                  ,  .T.   , .T.          ,          )
*                   cGetFile ( <cFileMask>, <cTitle>                    , [<nDefaultMask>], [<cInitialDirectory>], [lSave], [lLongNames], [nFlags] )  -> <sFileName>

SW := "
"

DEFINE FONT oFont_12 NAME "
Times New Roman" SIZE 0, -12 ITALIC
DEFINE FONT oFont_16 NAME "
Times New Romna" SIZE 0, -16 ITALIC BOLD

DO WHILE SW = "
"
 
 cpath := "
"
 cPath := cGetDir  ( "
Seleccione Directorio/Carpeta de imagenes *.bmp", "\"     , .T.     )
*         cGetDir  ( cTitle                                           , cInitDir, l95Look )

 IF LEN ( ALLTRIM ( cPath ) ) = 0
  SW := "
*"

 ELSE
  cPath     += "
\"
  aData_BMP := {}
  AEVAL ( DIRECTORY ( cPath + "
*.bmp" ), { | a | AADD ( aData_BMP, { cPath + a [ 1 ], SUBSTR ( a [ 1 ], 1, AT ( ".", a [ 1 ] ) - 1 ) } ) } )   && a [ 1 ] } ) } )
* STRTRAN ( a [ 1 ], "
.bmp", "" )  
*         Listado de imagenes bmp                                  imagen bmp      , nombre del archivo    

 DEFINE WINDOW oWnd_BMP

  oWnd_BMP:SetFont ( oFont_12 )
 
  DEFINE BUTTONBAR oBar_BMP OF oWnd_BMP SIZE 100,32 2007
   DEFINE BUTTON OF oBar_BMP PROMPT "
Vista_Verical"    ACTION ( oBrw_BMP:lListView := .T. )
   DEFINE BUTTON OF oBar_BMP PROMPT "
Vista_Cuadricula" ACTION ( oBrw_BMP:lGridView := .T. )

  @ 040, 020 XBROWSE oBrw_BMP SIZE -30, -30 PIXEL OF oWnd_BMP ;           && 40, 40
             DATASOURCE aData_BMP ;
             COLUMNS              ;
              1                  ,;
              2                   ;
             HEADERS              ;
              "
Foto"             ,;
              "
Código"            ;
             SIZES                ;
              060                ,;
              120                 ;
             NOBORDER             ;
             CLASS TXbrGrid ()

  WITH OBJECT oBrw_BMP
   :lHeader  := :lFooter  := .T.                     && .F.
   :lHScroll := :lVScroll := :lRecordSelector := .T.
 
   WITH OBJECT :aCols [ 1 ]
    :cDataType       := "
F"
    :nDataBmpAlign   := AL_CENTER
    :lBmpTransparent := .T.
   END

   :nRowHeight    := 60                                                                                           && Altura de la fila
   :CreateFromCode ()
  END

  oBrw_BMP:bRClicked := { | | xbrowse ( oBrw_BMP ) }                                                              && Cuando haga click sobre la imagen

 ACTIVATE WINDOW oWnd_BMP MAXIMIZED && ;
*         ON INIT ( oBrw_BMP:lGridView := .T. )

 ENDIF
ENDDO
 
RELEASE FONT oFont_12, oFont_16

Return ( NIL )
* ---------------------------------------------------------------------------------------------------------------- *


Añadir la clase

Saludos
J. Ernesto Pinto Q.
Fwh_x64 2407 + BCC++_x64 7_70__6_72 + Harbour 3.20 + LopeEdit 5.8 + UEstudio 26.0
jepsys@hotmail.com, jepsys@gmail.com, jepsys@yahoo.com
User avatar
J. Ernesto
 
Posts: 161
Joined: Tue Feb 03, 2009 10:08 pm
Location: Bogotá D.C. Colombia

Re: Cambio del tamaño de la imagen con thumbnails

Postby karinha » Tue May 24, 2016 6:01 pm

Que intentas hacer?

Image
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7800
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Cambio del tamaño de la imagen con thumbnails

Postby karinha » Tue May 24, 2016 6:02 pm

Image
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7800
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Cambio del tamaño de la imagen con thumbnails

Postby karinha » Tue May 24, 2016 6:11 pm

Fuentes y .EXE para testes:

http://www.4shared.com/rar/MlmW_uSTba/TXTGRID.html

Saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7800
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Cambio del tamaño de la imagen con thumbnails

Postby J. Ernesto » Wed May 25, 2016 6:25 pm

Estoy intentando agrandar la imagen para visualizarla mejor.
J. Ernesto Pinto Q.
Fwh_x64 2407 + BCC++_x64 7_70__6_72 + Harbour 3.20 + LopeEdit 5.8 + UEstudio 26.0
jepsys@hotmail.com, jepsys@gmail.com, jepsys@yahoo.com
User avatar
J. Ernesto
 
Posts: 161
Joined: Tue Feb 03, 2009 10:08 pm
Location: Bogotá D.C. Colombia

Re: Cambio del tamaño de la imagen con thumbnails

Postby nageswaragunupudi » Thu May 26, 2016 8:16 pm

I made this class in 2012.
\fwh\samples\xblstgrd.prg

Do you want to enlarge to its original size? or more than the original size?
Is it okay for you to see full image in separate dialog if you click on the image?

What is the latest fwh version you have?
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: VictorCasajuana and 44 guests