April 20, 2024, 04:10:01 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Drag a Bitmap

Started by GWS, January 22, 2012, 12:41:29 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

GWS

January 22, 2012, 12:41:29 PM Last Edit: January 23, 2012, 12:49:59 PM by GWS
Hi,

Here's a nice bit of work from long ago by Tony Jones - circa 2002 .. :)

Tony says:
QuoteI originally wanted to write a card game in "pure" IBasic without the need for a 3rd party DLL, but knew that it would take way too long to come up with the support for it, mainly the drag and drop routines.

In any case, below is what I came up with. It's based on an example in C that I found from Microsoft for Windows 3.1 circa 1993.

This is a detailed piece of work that is worth some study, using many graphics API routines.

I've included the .exe file for those who would like to try it, but don't have CB loaded.

all the best, :)

Graham

[Code amended as per Brian's comment below]



Tomorrow may be too late ..

Brian

Graham,

There's an error in this line (well, according to IWB, that is):

' Copy old background to screen
BitBlt(hdc,ImageInfo.bmX+dx,ImageInfo+dy,ImageInfo.bmWidth,ImageInfo.bmHeight,hdcOldBkg,0,0,SRCCOPY)

Needs changing to:
' Copy old background to screen
BitBlt(hdc,ImageInfo.bmX+dx,ImageInfo.bmY+dy,ImageInfo.bmWidth,ImageInfo.bmHeight,hdcOldBkg,0,0,SRCCOPY)

Brian

GWS

Brian,

Thanks for the correction.  Strange it didn't seem to affect the programs operation. ::)

I've altered the zip file in the first post ..

best wishes, :)

Graham

Tomorrow may be too late ..

Brian

Graham,

Actually, it did. When you drag the bitmap down to the bottom of the screen, it reacts
quite differently to when you drag it to the top, left and right sides

Brian

GWS

Yep, I hadn't studied it, so I reckon it might need a bit of thought about what behaviour is required at the screen edges.

all the best, :)

Graham

Tomorrow may be too late ..