q tal ... mmm ??? en Power Builder se puede utilizar funciones ubicadas en librerias .DLLs dentro de windows, a estas funciones se les denomina la API de Windows
- Declaras estas 3 funciones en 'Global External Functions' dentro de tu aplicacion
FUNCTION uLong GetDC (uLong hwnd) &
LIBRARY "user32.dll" ALIAS FOR "GetDC; ansi"
FUNCTION uLong LineTo (uLong hdc, uLong x, uLong y) &
LIBRARY "gdi32.dll" ALIAS FOR "LineTo; ansi"
FUNCTION uLong MoveToEx (uLong hdc, uLong x, uLong y, REF POINTAPI lpPoint) &
LIBRARY "gdi32.dll" ALIAS FOR "MoveToEx; ansi"
- Si te das cuenta la funcion 'MoveToEx' en el arg4 necesita una referencia a una estructura del tipo 'POINTAPI', por lo tanto creas una dentro de tu aplicacion.
File -> New -> Pestaña 'PBObject' -> Structure y Ok.
Creas dos variables:
unsignedlong | X
unsignedlong | Y
y guardas la estructura como 'pointapi'
- Utilizas las funciones API antes declaradas en tu codigo, ya tu ves en donde. Aqui te puse dos ejemplos.
Dibujando una Linea:
uLong dc
dc = GetDC(HANDLE(Parent))
POINTAPI lpPoint // estructura POINTAPI
lpPoint.x = 0; lpPoint.y = 0
// Linea Simple
MoveToEx(dc, 10, 10, lpPoint)
LineTo(dc, 120, 50)
Dibujando una funcion Seno:
uLong dc
dc = GetDC(HANDLE(Parent))
POINTAPI lpPoint // estructura POINTAPI
lpPoint.x = 0; lpPoint.y = 0
// Dibujando Sin(x)
Integer dx, dy
dx = 10; dy = 20
Double pX, pY
pX = 0 ;
pY = Sin(pX/5) * 15
MoveToEx(dc, dx + pX, dy + pY, lpPoint)
FOR pX = 0 TO 100
pY = Sin(pX/5) * 15
LineTo(dc, dx + pX, dy + pY)
NEXT
Aqui puedes ver como salieron las gráficas:
[attachment=0:3ct8zlmi]outImages.png[/attachment:3ct8zlmi]
Bueno espero que te sirva
, nos vemos
Salu2 !!!