473,472 Members | 2,038 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

manipulating images with the mouse

Hi,

I wish to create a little game where you drag pieces onto a board. I have
been playing around with a picture box:

Private Sub Picture1_DblClick()
Picture1.Left = Picture1.Left + 50
End Sub

Private Sub Picture1_DragOver(Source As Control, X As Single, Y As Single,
State As Integer)
Picture1.Left = Picture1.Left + 20
End Sub

I can move the picture when i double click it but not when i drag, dont
understand why though. I own three books on VB but none of them seem very
helpful on this matter, I rarely use graphics. Assuming i create a
collection of images representing the board and pieces, where should i
start? searches on the internet have turned up numerous examples of source
code, filled with windows api declarations and code i cannot easily follow,
so i would appreciate a little guidance for a graphics/animation beginner.

All i want to do is move the images in relation to the mouse, detect which
part of an image(the board) one of the pieces is over or perhaps i should
split the board into a grid made up of individual images and detect which
image the mouse is over if that is easier .

Can anyone provide a simple example, which demonstrates the principle of
moving one image over anotehr and getting the neccessary information about
the events, or point me to easy to follow resources?

Thanks for any help in advance.
Jul 17 '05 #1
5 4546
>
Can anyone provide a simple example, which demonstrates the principle of
moving one image over anotehr and getting the neccessary information about
the events, or point me to easy to follow resources?

Thanks for any help in advance.


I have an application that might mimic some parts of what you're
looking for. I'm a beginner at this, and not heavy into graphics
either, so I'm not sure what jargon to use that will give you an idea
of what I can provide--I'll just describe what mine does, and if you
want more let me know:

On a form, user clicks command buttons to create recognizable shapes
(platforms of various sizes, benches, etc). These shapes appear on a
picture box, and user can then drag them around, arrange them into
configurations, delete them, etc. The shapes snap onto each other, so
there's no guessing about the proper placement. If necessary, the
shapes can change their appearance depending on what they are
connected to.

I used User Controls to do this, and although it didn't work exactly
the way I thought it would it is still satisfactory. There's a bit of
indirection involved, but once you get used to it you can make them do
just about anything you want. I wouldn't say this process is easy to
follow, it took me quite a while to figure out--and can probably be
done in a better way using a lot of that API you mentioned, but I
managed with just a couple of those calls. Anyway, let me know if you
want some specific examples of the above, and perhaps others can
improve on any processes I outline.
Jul 17 '05 #2
"Kate" <ka**@curio.com> wrote in message
news:2c**************************@posting.google.c om...

Can anyone provide a simple example, which demonstrates the principle of
moving one image over anotehr and getting the neccessary information about the events, or point me to easy to follow resources?

Thanks for any help in advance.


I have an application that might mimic some parts of what you're
looking for. I'm a beginner at this, and not heavy into graphics
either, so I'm not sure what jargon to use that will give you an idea
of what I can provide--I'll just describe what mine does, and if you
want more let me know:

On a form, user clicks command buttons to create recognizable shapes
(platforms of various sizes, benches, etc). These shapes appear on a
picture box, and user can then drag them around, arrange them into
configurations, delete them, etc. The shapes snap onto each other, so
there's no guessing about the proper placement. If necessary, the
shapes can change their appearance depending on what they are
connected to.

I used User Controls to do this, and although it didn't work exactly
the way I thought it would it is still satisfactory. There's a bit of
indirection involved, but once you get used to it you can make them do
just about anything you want. I wouldn't say this process is easy to
follow, it took me quite a while to figure out--and can probably be
done in a better way using a lot of that API you mentioned, but I
managed with just a couple of those calls. Anyway, let me know if you
want some specific examples of the above, and perhaps others can
improve on any processes I outline.


Hi thanks for your message,

I did a search on the internet for user controls, is this related to them?

http://msdn.microsoft.com/msdnmag/is...s/default.aspx

because if it is I think user controls are only available in .Net and I am
using VB 6. Can you explain that bit about indirection again, might have
gone over my head :).

i suspect what you describe sounds more complicated than what I am trying to
achieve. All I want is to tile some bordered images in a picture box to
create a board, such as in a chess or checkers board. since my original
post I have learned about a windows api call known as BitBlt in the GDI dll
and I am trying to figure out how to use that properly. any explanations
welcome.

the next thing is to create images representing pieces and enable them to be
dragged and placed with the mouse to their appropriate positions within the
picture box. Again any example code for visual basic 6, which achieves
something similar or demonstrates related principles, is most welcome.

thanks.
Jul 17 '05 #3
"Jason" <ja***********@btinternet.com> wrote
the next thing is to create images representing pieces and enable them to be
dragged and placed with the mouse to their appropriate positions within the
picture box. Again any example code for visual basic 6, which achieves
something similar or demonstrates related principles, is most welcome.


Here is an example of dragging. Click the mouse on the form to start dragging.
It draws a black box where the drag started from, and a red square where it
ends. While dragging it shows an icon, but that should be an icon of the piece
being moved. You have to imagine the board is shown, the example only does
the drag part....

http://groups.google.com/groups?selm...usinternet.com

HTH
LFS


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 17 '05 #4

"Larry Serflaten" <Ab***@SpamBusters.com> wrote in message
news:40********@corp.newsgroups.com...
"Jason" <ja***********@btinternet.com> wrote
the next thing is to create images representing pieces and enable them to be dragged and placed with the mouse to their appropriate positions within the picture box. Again any example code for visual basic 6, which achieves
something similar or demonstrates related principles, is most welcome.
Here is an example of dragging. Click the mouse on the form to start

dragging. It draws a black box where the drag started from, and a red square where it ends. While dragging it shows an icon, but that should be an icon of the piece being moved. You have to imagine the board is shown, the example only does
the drag part....

http://groups.google.com/groups?selm...usinternet.com

HTH
LFS


thank you, i think this is going to be useful to me.
Jul 17 '05 #5
> I did a search on the internet for user controls, is this related to them?

http://msdn.microsoft.com/msdnmag/is...s/default.aspx

because if it is I think user controls are only available in .Net and I am
using VB 6. Can you explain that bit about indirection again, might have
gone over my head :). It is related, but I use VB6. I tried a few things using GDI but it
was well over my shallow head so I just muddled around with more
manual work.
i suspect what you describe sounds more complicated than what I am trying to
achieve. All I want is to tile some bordered images in a picture box to
create a board, such as in a chess or checkers board. since my original
post I have learned about a windows api call known as BitBlt in the GDI dll
and I am trying to figure out how to use that properly. any explanations
welcome.
the next thing is to create images representing pieces and enable them to be
dragged and placed with the mouse to their appropriate positions within the
picture box. Again any example code for visual basic 6, which achieves
something similar or demonstrates related principles, is most welcome.

There are probably many ways to accomplish this, but what I required
in my pieces was a lot of ability to interact and make decisions for
themselves, based on what they discovered about their placement each
time they were moved.

Take a look here: this tiny example program really gave me a solid
starting point in investigating user controls for my application.

http://pages.cpsc.ucalgary.ca/~saul/vb_examples/
[look under the heading Active X Controls, then download the sample
program
"Follow Me"]

Do you know yet how you are going to create the images to represent
pieces?
Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Lijun Yang | last post by:
Hey, I am able to disable the right mouse button on images for netscape and IE but it won't work for Opera. Here is the code: // start of the code var clickmessage="Sorry, you don't have...
4
by: VR | last post by:
Hi, I am trying to have a menu item (which is an HTML img) to change as a mouse moves over it. So, my code looks something like this: <a onmouseover="ActivateImage('MyImage');"...
0
by: Rob | last post by:
I've created an application which is intended to allow users to draw a diagram of a network - with workstations, servers, switches, links (all devices in my language) etc. I've created a user...
0
by: mkumar20xx | last post by:
hi Guys, I am a beginner in flash. i have made some flash movies and have some understanding on actionscripts. my question is how to make flash movie which will dynamically load thumbnail...
3
by: Cyprus106 | last post by:
Does anybody have any good websites, books, whatever for working with and manipulating images? Topics I need some information on are conversions (to greyscale, from one type to another, etc.), line...
2
by: bahnfire | last post by:
Hi, I am hoping that I finally have the right group :-) I am using Visual C++ Express 2008 and am trying to change the taskbar icon that I am using (notifyIcon1) as some state changes (button...
4
by: rduarte | last post by:
Hello, I'm new to Windows Forms development in C#, and I'm having some trouble with a college project. Simply put, it is a paint-like application, that has a toolbox to draw shapes where the mouse...
5
matheussousuke
by: matheussousuke | last post by:
Hello, I'm using tiny MCE plugin on my oscommerce and it is inserting my website URL when I use insert image function in the emails. The goal is: Make it send the email with the URL...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.