Aqui esta el codiguito en "C" a ver si alguien del foro que sepa mucho del "C" nos ayuda
Code: Select all
#include <WinTen.h>
#include <Windows.h>
#include <ShellApi.h>
#include <ClipApi.h>
//----------------------------------------------------------------------------//
CLIPPER DRAWDIGIT( PARAMS ) // hDC, nTop, nLeft, nBottom, nRight, cDigit, nPos,
// hFont, nClrPane, nClrText
{
HDC hDC = ( HDC ) _parnl( 1 );
long wRow;
long wCol;
RECT rct;
LPSTR szChar = _parc( 6 );
LPSTR szChar_ = "0";
int nPos = _parnl( 7 );
COLORREF nClrBack = _parnl( 9 );
COLORREF nClrFore = _parnl( 10 );
HFONT hFont = ( HFONT ) _parnl( 8 );
HFONT hOldFont;
TEXTMETRIC tm;
DWORD dwCWidth;
int nHeight;
if( hFont )
hOldFont = SelectObject( hDC, hFont );
GetTextMetrics( hDC, &tm );
szChar_[ 0 ] = szChar[ 0 ] + 1;
if ( szChar_[ 0 ] == ':' ) szChar_[ 0 ] = '0';
rct.top = _parni( 2 );
rct.left = _parni( 3 );
rct.bottom = _parni( 4 );
rct.right = _parni( 5 );
dwCWidth = MAX( GetTextExtent( hDC, szChar, 1 ), tm.tmAveCharWidth );
wCol = ( rct.right + rct.left - dwCWidth + 1 ) / 2;
wRow = rct.top - 1;
if ( nPos > 0 ) nHeight = rct.top - rct.bottom;
else nHeight = rct.bottom - rct.top;
SetTextColor( hDC, nClrFore );
SetBkColor( hDC, nClrBack );
ExtTextOut( hDC, 1, 1, ETO_OPAQUE, &rct, "", 0, 0 );
ExtTextOut( hDC, wCol, wRow + nPos, ETO_CLIPPED, &rct, szChar, 1, 0 );
ExtTextOut( hDC, wCol, wRow + nPos + nHeight, ETO_CLIPPED, &rct, szChar_, 1, 0 );
// DrawText( hDC, szChar, 1, &rct, (DT_CENTER || DT_VCENTER) );
if( hFont )
SelectObject( hDC, hOldFont );
_ret();
}
//----------------------------------------------------------------------------//
CLIPPER DIGITSBOX( PARAMS ) // hWnd, nDigits, nHeight, nWidth, l3D
{
int i;
HWND hWnd = ( HWND ) _parnl( 1 );
WORD wDigits = _parni( 2 );
WORD wHeight = _parni( 3 );
WORD wWidth = _parni( 4 );
WORD wCol = 1;
WORD wLong = wDigits * wWidth + 1;
HPEN hPBlack = CreatePen( PS_SOLID, 1, RGB( 0, 0, 0 ) );
BOOL b3DLook = _parl( 5 );
HPEN hPUpLeft;
HPEN hPBotRit;
HDC hDC = GetDC( hWnd );
HPEN hOldPen = SelectObject( hDC, hPBlack );
MoveTo( hDC, 1, 1 );
LineTo( hDC, wLong, 1 );
LineTo( hDC, wLong, wHeight );
LineTo( hDC, 1, wHeight );
LineTo( hDC, 1, 1 );
for ( i = 1; i < wDigits ; i++ )
{
wCol += wWidth;
MoveTo( hDC, wCol, 1 );
LineTo( hDC, wCol, wHeight );
}
if ( b3DLook )
{
hPUpLeft = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNSHADOW ) );
hPBotRit = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNHIGHLIGHT ) );
SelectObject( hDC, hPUpLeft );
MoveTo( hDC, 0, wHeight + 1 );
LineTo( hDC, 0, 0 );
LineTo( hDC, wLong + 1, 0 );
SelectObject( hDC, hPBotRit );
LineTo( hDC, wLong + 1, wHeight + 1 );
LineTo( hDC, 0, wHeight + 1 );
DeleteObject( hPUpLeft );
DeleteObject( hPBotRit );
}
SelectObject( hDC, hOldPen );
DeleteObject( hPBlack );
ReleaseDC( hWnd, hDC );
_ret();
}