home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BUG 4
/
BUGCD1997_05.BIN
/
aplic
/
clip4win
/
clip4win.exe
/
C4W30E.HUF
/
SOURCE
/
CONTRIB
/
TEXTOUTS.ZIP
/
TEXTOUTS.PRG
Wrap
Text File
|
1994-05-24
|
2KB
|
52 lines
// function.: TextOuts.prg
// Author...: Gerald Barber
// Date.....: November 28, 1993; Last Updated 05/24/94 09:27 pm
// Notice...: Copyright 1993 - 1994, Gerald Barber
// Notes....: Decimal, Right, Left, and Center Text Out
#include "align.ch"
#xtranslate GetInt( <f> ) => ;
if('.' $ <f>, substr( <f>, 1, at('.', <f>) - 1), <f> )
#xtranslate GetDec( <f> ) => ;
if('.' $ <f>, substr( <f>, at('.', <f>) + 1), "" )
function dTextOut(hDC, x, y, cText)
local dWidth := C4W_LoWord( GetTextExtent(hDC,".",1) ) / 2
local wFlags := SetTextAlign(hDC, C4W_OR(TA_RIGHT,TA_TOP))
TextOut(hDC, x - dWidth, y, GetInt(cText))
if ('.' $ cText)
SetTextAlign(hDC, C4W_OR(TA_CENTER,TA_TOP))
TextOut(hDC, x , y, "." )
SetTextAlign(hDC, C4W_OR(TA_LEFT,TA_TOP) )
TextOut(hDC, x + dWidth, y, GetDec(cText))
endif
SetTextAlign (hDC, wFlags)
return .t.
function rTextOut(hDC, x, y, cText)
local wFlags := SetTextAlign(hDC, C4W_OR(TA_RIGHT,TA_TOP))
TextOut(hDC, x, y, cText)
SetTextAlign (hDC, wFlags)
return .t.
function lTextOut(hDC, x, y, cText)
local wFlags := SetTextAlign(hDC, C4W_OR(TA_LEFT,TA_TOP))
TextOut(hDC, x, y, cText)
SetTextAlign (hDC, wFlags)
return .t.
function cTextOut(hDC, x, y, cText)
local wFlags := SetTextAlign(hDC, C4W_OR(TA_CENTER,TA_TOP))
TextOut(hDC, x, y, cText)
SetTextAlign (hDC, wFlags)
return .t.
static function SetTextAlign(hDC, wFlag)
local hLib := LoadLibrary("GDI.EXE")
local cSTA := GetProcAddress(hLib,"SetTextAlign","Pascal","Word","hDC, int")
local lTA := CallDLL( cSTA, hDC, wFlag )
FreeLibrary( hLib )
return lTA