RESPONDER UNA PREGUNTA

Si para responder la pregunta, crees necesario enviar un archivo adjunto, puedes hacerlo a traves del correo [email protected]

    Pregunta:  45230 - CREAR BITMAP USANDO SDK :CREATECOMPATIBLEBITMAP Y SETPIXEL
Autor:  Oscar Amesty
estoy tratando de crear un bitmap dinamicamente y estoy utilizando el SDK de windows, a traves de las funciones CreateCompatibleBitmap para instanciar el bitmap en un picture control, y la funcion SetPixel para colorear el pixel correspondiente, declare las external functions asi:

FUNCTION long CreateCompatibleBitmap(ref long hdc, int nWidth, int nHeigth) LIBRARY "gdi32.dll"
FUNCTION long SetPixel(long hdc, int x, int y, long crcolor) LIBRARY "gdi32.dll"

y estoy utilizandolo en un boton asi:

long hdc, hdc1
long colorref, color
// p_1 es un picture control

p_1.setredraw(false)

hdc = handle(p_1)

hdc1 = CreateCompatibleBitmap(hdc,100,100)

if isnull(hdc1) then
messagebox('error', 'no creo el bitmap')
else
messagebox('error', 'si creo el bitmap')
color = rgb(255,0,0)
messagebox('color',string(color))
colorref = SetPixel(hdc, 20, 20, color)
if colorref = -1 then messagebox('error','error asignando color')
end if

p_1.setredraw(true)

gracias de antemano por la ayuda


Nombre
Apellidos
Correo
Comentarios