Results 1 to 5 of 5

Thread: [2005] help with interactive images

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2006
    Posts
    3

    [2005] help with interactive images

    I'm new here so I'd first like to start by saying a formal hello to everyone I recently did the switch from vb6 to vb.net and ran into my first snag. I need a way to make a map in my program have 5 seperate regions that are able to be clicked on and envoke a command. The ocx i was attempting to use from silverband software entitled image vb is a vb6 based controller and doesn't seem to want to play nicely in 2005. Any help is greatly apperciated. Thanks.

  2. #2
    Frenzied Member conipto's Avatar
    Join Date
    Jun 2005
    Location
    Chicago
    Posts
    1,175

    Re: [2005] help with interactive images

    Instead of using the Click function, you can make a sub for the mousedown event. Inside that event, the X and Y position of the mousedown is available using the MouseEventArgs parameter, such as this:

    VB Code:
    1. Private Sub PictureBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown
    2.         If e.X > SomeValue AndAlso e.X < SomeOtherValue AndAlso e.Y > SomeYValue AndAlso e.Y < SomeOtherYValue Then
    3.                    'Inside region
    4.         End If
    5.     End Sub

    Bill
    Hate Adobe Acrobat? My Codebank Sumbissions - Easy CodeDom Expression evaluator: (VB / C# ) -- C# Scrolling Text Display

    I Like to code when drunk. Don't say you weren't warned.

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2006
    Posts
    3

    Re: [2005] help with interactive images

    Bill

    Apperciate the help. It appears that the code is for rectangle and square regions any idea how to do it for a odd shape polygon this is a copy of the coordinate file for the map where the regions are located.

    <MAP name="Airfield">
    <AREA id="air1" shape=POLY coords=400,160,265,162,273,428,385,434,435,308>
    <AREA id="air2" shape=POLY coords=21,301,126,333,253,410,347,606,180,614,26,612>
    <AREA id="air3" shape=POLY coords=665,305,477,298,454,411,353,463,353,566,662,623>
    <AREA id="air4" shape=POLY coords=647,6,384,15,379,138,473,178,478,255,604,280,647,204>
    <AREA id="term" shape=POLY coords=35,7,330,9,124,318,27,286>
    </MAP>

  4. #4
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [2005] help with interactive images

    whay exact problem are you having with the OCX? for the most part, you should be able to use activeX controls from VB6 in .NET

  5. #5

    Thread Starter
    New Member
    Join Date
    Apr 2006
    Posts
    3

    Re: [2005] help with interactive images

    problem is i set the image and coordinate file into the property fields after which i complete the following as the example shows on the vb image site.

    Private Sub airmap_HotspotMouseDown(air1 As _
    String, Button As Integer, Shift As Integer, X As _
    Single, Y As Single)

    msgbox("air side one")

    End Sub

    the airmap is the name of the refrenced image and the air1 is the id reference from a html file i have included. I have it set to envoke a msgbox to make sure it works but no matter how i tweek the settings i can't seem to find much succcess.

    ~Tim

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width