Jump to content

A Visual Basic 2008 Question


RSBDavid

Recommended Posts

Is it possible to Divide an image into 5 or so different parts across 5 picture boxes without photoshoping the picture into 5 parts and then use 5 picboxes? I need to do this, so if a user clicks a certain part of the picture box I can program some event to go along with it.

wii_wheaton.png

[software Engineer] -

[Ability Bar Suggestion] - [Gaming Enthusiast]

Link to comment
Share on other sites

Is it possible to Divide an image into 5 or so different parts across 5 picture boxes without photoshoping the picture into 5 parts and then use 5 picboxes? I need to do this, so if a user clicks a certain part of the picture box I can program some event to go along with it.

 

 

 

Hmmm... day or 2 old topic but no responses... lets see if I have any kind of insight with this...

 

 

 

I'm not familiar with VB08 so I can't be sure if anything I'm about to say works, but wouldn't it be possible to check where the click was on the picture (pixel x pixel)? If so, then simply create 1 single Subroutine for when they click on the picture and use that to establish where the click was. Then, depending on where the click falls in based on ranges you'll set up, have it execute 1 of X-many other Subroutines related to each individual area of the picture, but not actually attached to the picture directly in terms of how the program is executed.

 

 

 

 

 

So as a general layout of the code, you could have something to the following.

 

 

 

-On click of the picture-

*code to find which pixel exactly was clicked*

If (location) was between (X1,Y1) and (X2,Y2) Then

 Run (code 1)

Elseif (location) was between (X3,Y3) and (X4,Y4) Then

 Run (code 2)

etc

etc

 

 

 

So while you aren't actually "dividing" the image, you are creating a code that can determine which area, that you would have established before, was clicked in and execute the code appropriately.

 

 

 

Sorry I can't be more help, but I left all of my reference books back on my campus (Christmas holiday atm) and those are all Visual Basic 6 books regardless, so I can't really give you exact code.

f475e02ecc.png

don't worry, you are going to "hell" anyway. wanna race to see who gets there first?

Officially reached 100 Combat at 1:33PM EST, June 14, 2007

First Dragon Drop: Dragon Chain (Dust Devils) @ 10:48PM EST, July 14, 2008, lv113 combat

Link to comment
Share on other sites

This is pretty simple if you know where to look.

 

Double click the picture box in question.

 

Now your in the code view, there should be 2 drop down boxes just above the code.

 

Click the one on the right and select on Mouse Click.

 

Now add this to the sub

 

        Dim MouseX As Integer = e.X

       Dim MouseY As Integer = e.Y

 

 

 

Now you can simply pick off the the x and y locations you wish to use.

 

Remember 0,0 will be the top left.

[hide=Drops]

  • Dragon Axe x11
    Berserker Ring x9
    Warrior Ring x8
    Seercull
    Dragon Med
    Dragon Boots x4 - all less then 30 kc
    Godsword Shard (bandos)
    Granite Maul x 3

Solo only - doesn't include barrows[/hide][hide=Stats]

joe_da_studd.png[/hide]

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.