Cuantos pixeles es un centimetro

Cuantos pixeles es un centimetro

Postby Vladimir Zorrilla » Fri Aug 21, 2009 5:35 am

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
Vladimir Zorrilla
 
Posts: 225
Joined: Tue Feb 28, 2006 4:25 pm
Location: PERU

Re: Cuantos pixeles es un centimetro

Postby FiveWiDi » Fri Aug 21, 2009 12:22 pm

Creo que esto te servirá:

Code: Select all  Expand view  RUN

#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 24.02 + Harbour 3.2.0dev (r2403071241), BCC 7.7 Windows 10
FiveWiDi
 
Posts: 1202
Joined: Mon Oct 10, 2005 2:38 pm


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 106 guests