Cuantos pixeles es un centimetro

Post Reply
Vladimir Zorrilla
Posts: 225
Joined: Tue Feb 28, 2006 4:25 pm
Location: PERU

Cuantos pixeles es un centimetro

Post 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
ME INTERESA FW Y XHB POR SER OPEN SOURCE
FiveWiDi
Posts: 910
Joined: Mon Oct 10, 2005 2:38 pm

Re: Cuantos pixeles es un centimetro

Post 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.
Un Saludo
Carlos G.

FiveWin 19.06 + Harbour 3.2, BCC 7 Windows 10
Post Reply