PenWidtH

PenWidtH

Postby antolin » Thu Jul 11, 2013 9:21 am

Me he encntrado con el problema de que tenía que averiguar, en tiempo de ejecución, que anchura tenía un PEN determinado. Me venía un hPen y tenía que saber cuanto medía de ancho la línea dibujada con ese PEN, para calcular unos recuadros.

Lo solucioné en Borland C, así. Por si a alguien le interesa:

Code: Select all  Expand view
...
...
#include <wingdi.h>

HB_FUNC( NPENWIDTH )  // nPenWidth( hPen )
   {
   HPEN hPen = ( HPEN ) hb_parnl( 1 ) ;
   LOGPEN stPen ;

   GetObject( ( HPEN ) hPen, sizeof( LOGPEN ), &stPen ) ;

   hb__retnl( (LONG) stPen.lopnWidth.x ) ;
   }

Si lo que quereis es saber cúal es su color retornad:
Code: Select all  Expand view
hb__retnl( (LONG) stPen.lopnColor ) ;

Y si lo que quereis es el estilo que trae:
Code: Select all  Expand view
hb__retnl( (LONG) stPen.lopnStyle ) ;


Un saludo.
Peaaaaaso de foro...
FWH 2007 - xHarbour - BCC55
antolin
 
Posts: 498
Joined: Thu May 10, 2007 8:30 pm
Location: Sevilla

Re: PenWidtH

Postby hmpaquito » Thu Jul 11, 2013 10:59 am

Hola Antolín,

Aunque no crea que lo vaya a utilizar, muchas gracias. Me gusta ver cómo se pueden solucionar todos los problemas de más "bajo nivel".

Me gustan todas tus aportaciones, siempre son impactantes, como la que nos has traído hoy. Todavía recuerdo aquel trabajo tuyo utilizando el gdiplus y que amablemente compartiste con el foro.

Felicidades y como dicen los angloparlantes: mantente arriba.

Un saludo
hmpaquito
 
Posts: 1482
Joined: Thu Oct 30, 2008 2:37 pm


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 46 guests