CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2001
    Posts
    1

    Clickable images

    Does anyone know how to create clickable images similar to clickable images in HTML. I want to create an application with an interactive image. When the user clicks on different parts of the image the application should respond accordingly. I've been looking but can't find any information regarding this

    Hope someone can help...


  2. #2
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: Clickable images

    use an array of images (or more than one image) to dispay them as a contiguos one
    Then code the (one for each imagebox):

    private Sub Image1_Click()
    'your code for clicking on this piece of image
    End Sub
    'or code the (for an array of imagebox)
    private Sub Image1_Click(Index as Integer)
    'your code for an index image
    'ie:
    select case index
    case 0 'first image clicked
    'your code for this click
    case 1 'second... and so on
    'your code for this click
    end select
    End Sub





    Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, Bruno Paris and all the other wonderful people who made and make Codeguru a great place. Come back soon, you Gurus.
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  3. #3
    Join Date
    Mar 1999
    Location
    Nepal
    Posts
    540

    Re: Clickable images

    Display your image in a picture box.

    Then there are several functions such as CreateRectRgn(), CreateEllipticRgn(), CreatePolygonRgn() etc, that allow you to create regions of different shapes. Create a region that defines your clickable area.

    In Picture1_MouseDown, check if the point is within one of the regions using PtInRegion(). If it is then do something.




  4. #4
    Join Date
    Dec 1999
    Location
    Dublin, Ireland
    Posts
    1,173

    Re: Clickable images

    I have knocked this lot together to make a Visual Basic control version of the HTML client side Image Map and am looking for Beta testers.

    I'll put the control (and code) up at http://www.merrioncomputing.com/Download/index.htm in the next couple of days...it basically works now but the interface for creating the image map items could do with cleaning up a bit.

    Thanks in advance,
    Duncan

    -------------------------------------------------
    Ex. Datis: Duncan Jones
    Merrion Computing Ltd
    http://www.merrioncomputing.com
    '--8<-----------------------------------------
    NEW -The printer usage monitoring application
    '--8<------------------------------------------

  5. #5
    Join Date
    Dec 1999
    Location
    Dublin, Ireland
    Posts
    1,173

    Re: Clickable images

    The control is now available to download (with complete source)

    HTH,
    Duncan

    -------------------------------------------------
    Ex. Datis: Duncan Jones
    Merrion Computing Ltd
    http://www.merrioncomputing.com
    Check out the new downloads - EventVB.OCX for adding new events to your VB form and adding System Tray support simply, MCL Hotkey for implemenmting system-wide hotkeys in your application...all with source code included.
    '--8<-----------------------------------------
    NEW -The printer usage monitoring application
    '--8<------------------------------------------

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

Featured