1. RE: displaying bitmaps and deleting old bitmaps--Thanks to all

Hello,
Thanks to all who gave me info. I am slowly understanding Euphoria.
Jim

-----Original Message-----
From: Derek Parnell [mailto:ddparnell at bigpond.com] 
Subject: Re: displaying bitmaps and deleting old bitmaps



----- Original Message ----- 
From: "sixs" <sixs at ida.net>
To: <EUforum at topica.com>
Sent: Tuesday, January 06, 2004 3:24 AM
Subject: displaying bitmaps and deleting old bitmaps


> 
> 
> Hello.
> I am getting different pictures from the internet. They are of various
> sizes. I display one, then anoher and I may want to redisplay one I
had
> previously displayed. Code is :
> hBitmap = loadBitmapFromFile(hSle9),
> then in onPaint  I am performing this code
>  
>              if db_table_size() > 0  then
>                         if atom(hBitmap) then
>                         deleteObject ( Bitmap54)
>                                     extent = getExtent(MyWin)
>                                     i = 241
>                                     j = 42
>                                     drawBitmap( MyWin, hBitmap, i, j)
>                         end if
>             end if
> The pictures are not of the same size and so some of the previous
> picture is left on the screen. How do I remove the previous picture
> without forcing each picture to be the same size,  or must I edit each
> picture in a photo program????
> Thanks  for any help
>  

You might be doing it the hard way. Why not consider using Win32lib's
Bitmap control? You don't have to worry about handling paint messages or
resizing it as its done automatically for you.

Here is an example program ...

-- example10.exw
-- This example opens a window, and places bitmaps in it.

without warning
include win32lib.ew

constant MainWindow =  
    create( Window, "Click to show another bitmap", 0, Default, Default,
400, 400, 0 )

constant BitmapArea =
    create( Bitmap, "", MainWindow, 0, 0, 132, 132,0 )

integer vBM_Index
object vBM_Files

procedure Change_Bitmap(integer self, integer event, sequence parms)
    
    if sequence(vBM_Files) and length(vBM_Files) > 0 then
        -- Every click gets the next bitmap
        vBM_Index += 1
        if vBM_Index > length(vBM_Files) then
            -- To back to first bitmap
            vBM_Index = 1
        end if
        setBitmap( BitmapArea, vBM_Files[vBM_Index][D_NAME] )
    end if

end procedure

vBM_Index = 0
vBM_Files = dir("*.bmp") -- Look for any bitmaps.
if not sequence(vBM_Files) or length(vBM_Files) = 0 then
    VOID = message_box("This demo needs one or more bitmap vBM_Files in
the directory.","",0)
end if    

setHandler(MainWindow, {w32HActivate, w32HClick}, routine_id(
"Change_Bitmap" ))
WinMain( MainWindow, Maximize )

-- 
Derek



TOPICA - Start your own email discussion group. FREE!

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu