Page 1 of 1

Cuantos pixeles es un centimetro

Posted: Fri Aug 21, 2009 5:35 am
by Vladimir Zorrilla
Amigos
¿Ccuantos pixeles es un centimetro?

Si hago una grilla con esta funcion como le digo que me la hag a 1 cm de separacion
oForm es el objeto dialogo

func ponergrilla(oForm,nwnGridX,nwnGridY)
Local nGridX := 6, nGridY := 6
oForm:bPainted = { | hDC, cPS | DrawGrid( oForm:hWnd, hDC, cPS, nGridX, nGridY ) }
oForm:Refresh()
retu .t.


En este codigo plantailla el 0.5 que es medio centimetro

function Main()

local oDlg, oFld

DEFINE DIALOG oDlg SIZE 400, 300

@ 0.5, 1 FOLDER oFld OF oDlg SIZE 188, 138 ;
PROMPTS "One", "Two", "Three"

ACTIVATE DIALOG oDlg CENTERED

return nil

Gracias pore las respuestas

Re: Cuantos pixeles es un centimetro

Posted: Fri Aug 21, 2009 12:22 pm
by FiveWiDi
Creo que esto te servirá:

Code: Select all

#include "FiveWin.ch"

#define HORZSIZE          4
#define VERTSIZE          6
#define HORZRES           8
#define VERTRES          10
#define LOGPIXELSX       88
#define LOGPIXELSY       90


/* ****************************************************************************
Funciones para convertir PIXEL a Twip/Pulgadas/Centímetros y viceversa.

   ************************************************************************* */

/* ******************************************************* */
FUNCTION nPixels2Twips( hDC, nPixels, lVertical )
Return (nPixels / GetDeviceCaps( hDC, If(lVertical, LOGPIXELSY, LOGPIXELSX) ) ) * 1440
/* ******************************************************* */
FUNCTION nTwips2Pixels( hDC, nTwips, lVertical )
Return (nTwips / 1440) * GetDeviceCaps( hDC, If(lVertical, LOGPIXELSY, LOGPIXELSX) )
/* ******************************************************* */
FUNCTION nPixels2Inches( hDC, nPixels, lVertical )
Return (nPixels / GetDeviceCaps( hDC, If(lVertical, LOGPIXELSY, LOGPIXELSX) ) )
/* ******************************************************* */
FUNCTION nInches2Pixels( hDC, nInches, lVertical )
LOGPIXELSY, LOGPIXELSX) ) )
Return (nInches * GetDeviceCaps( hDC, If(lVertical, LOGPIXELSY, LOGPIXELSX) ) )
/* ******************************************************* */
FUNCTION nPixels2Cm( hDC, nPixels, lVertical )
Return nPixels2Inches( hDC, nPixels, lVertical ) * 2.54
/* ******************************************************* */
FUNCTION nCm2Pixels( hDC, nCm, lVertical )
Return nInches2Pixels( hDC, (nCm / 2.54), lVertical )
/* ******************************************************* */
FUNCTION uCm2Pixels( HdC, nCmy, nCmx )
nCmy := nCm2Pixels( hDC, nCmy, .T. )
nCmx := nCm2Pixels( hDC, nCmx, .F. )
Return Nil
 
Un Saludo
Carlos G.