IonicWind Software

IWBasic => General Questions => Topic started by: Egil on July 12, 2009, 06:28:32 AM

Title: Working with large bitmaps
Post by: Egil on July 12, 2009, 06:28:32 AM
I have in my posession a nice little piece of shareware called ShipPlotter. The program is able to load BMP and JPG files much larger than the client window, so only a small portion is shown at the time. To navigate within the picture, I hold down the left mouse button and drag the bitmap around.

Does anyone know how to do something similar with EB?
Title: Re: Working with large bitmaps
Post by: sapero on July 12, 2009, 08:10:48 AM
It's simple, just allocate five additional global variables (pos_x, pos_y, click_x, click_y, LeftDown) for each image, and respond to messages this way: (pos_x, pos_y must be signed)
@IDLBUTTONDOWN - save mouse position in click_x and click_y, set LeftDown to TRUE
@IDLBUTTONUP - set LeftDown to FALSE
@IDMOUSEMOVE - do nothing if LeftDown is not TRUE, else compute signed delta x and y: delta_* = @MOUSE* - click_*. Subtract delta's from pos_x and pos_y, ensure pos_* is in the valid range (0 <= pos_x <= image.width-visible.width), then callShowImage(win, image, type, pos_x, pos_y, visible_width, visible_height)

If you call SetCapture(hwnd) api inside @IDLBUTTONDOWN handler, you will be able to move the image even after the mouse leaves the window, but don't forget to call ReleaseCapture() inside @IDLBUTTONUP.
Title: Re: Working with large bitmaps
Post by: Egil on July 12, 2009, 11:29:40 AM
Thanks sapero! ;D ;D ;D ;D ;D