473,385 Members | 2,210 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

GDI+ and Image Maps

Is it possible to use image maps to divide up a picture acting as an image
button?

I have created a map of a building, and now I want to have some sort of
pop-up messages when certain parts of the building are moused over. The
only way I can think to do this (without using javascript), is to divide the
image into sections with an image map and have the pop-ups display my info.
I've never made an image map before, nor have I dealt with asp.net image
buttons up until recently. I just wanted to confirm the feasibility before
I learn image maps and spend a whole day trying to make them work right.

Please help me if you have time.

-Kevin

P.S. Below is the code, in case you're interested in what I'm doing.
Replace acg.gif with a map, and diamond_pink.gif with a marker (mine is an
11x11px diamond). You can click on the map and that's where the diamond
comes up. I'm recording the coordinates in a database, and that alllows me
to see where my computers are. I just need an easy, intuitive, way to
identify the computers.

**** map.aspx ****

<%@ import namespace="system.drawing" %>

<script runat="server">

sub Page_Load
if not ispostback then
ibtnmap.imageurl = "rendermap.aspx"
end if
end sub

sub ibtnmap_click(s as object, e as imageclickeventargs)
ibtnmap.imageurl = "rendermap.aspx?x=" & e.x & "&y=" & e.y
response.write("x is: " & e.x & ", y is: " & e.y)
end sub

</script>

<html>
<body>
<form runat="server">
<asp:imagebutton
id="ibtnmap"
onclick="ibtnmap_click"
runat="server"
/>
</form>
<body>
</html>

**** rendermap.aspx ****

<%@ page contenttype="image/gif" %>
<%@ import namespace="system.drawing" %>
<%@ import namespace="system.drawing.imaging" %>

<script runat="server">

sub Page_Load
dim objbitmap1 as bitmap
dim objbitmap2 as bitmap
dim objstarbitmap as bitmap
dim objgraphics as graphics
dim xcoor as integer = request.querystring("x")
dim ycoor as integer = request.querystring("y")

objstarbitmap = new bitmap("c:\pccasnmp\_images\diamond_pink.gif")
objbitmap1 = new Bitmap("c:\pccasnmp\_images\acg.gif")
objbitmap2 = new bitmap(objbitmap1.width, objbitmap1.height)
objgraphics = graphics.fromimage(objbitmap2)
objgraphics.drawimage(objbitmap1, new rectangle(0,0,objbitmap2.width,
objbitmap2.height),0,0,objbitmap1.width,objbitmap1 .height,graphicsunit.pixel
)
objgraphics.drawimage(objstarbitmap,new rectangle(x - 5,y -
5,11,11),0,0,objstarbitmap.width,objstarbitmap.hei ght,graphicsunit.pixel)

objbitmap2.save(response.outputstream,imageformat. gif)

end sub

</script>
Nov 17 '05 #1
0 1457

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

Similar topics

4
by: Stanimir Stamenkov | last post by:
I have this kind of construct: http://www.geocities.com/stanio/temp/usemap01.html (an IMG element using MAP described with AREA elements) I'm trying to make it more accessible and currently...
4
by: Michael Kennedy [UB] | last post by:
Hi Everyone, I have this multithreaded C# windows forms application which does a lot of image processing. Occasionally, I get the following error: A generic error occurred in GDI+....
5
by: anonymous | last post by:
I'm writing a program that deals extensively with the printer. For the most part my application runs fine, but occasionally I run into some Exceptions. The most common exceptions I run into are...
1
by: Prasad More | last post by:
Hello, I am trying to write a text on Multi-page TIFF image using C# and .NET GDI+. I have written following code to do this. When I execute this code I get "Invalid Parameter User. at...
7
by: news | last post by:
This may be a stupid question, but if I don't ask I'll never know ;) Ok, here it goes.... I am writing an application that renders an image in one picturebox and a graph in another. The image...
13
by: lgbjr | last post by:
Hello All, I have some pictureboxes on a VB.NET form that are linked to an AccessDB. If the user wishes to open or edit an image, I need to save the image in the picturebox to a temp file, then...
15
by: David Lozzi | last post by:
Howdy, I have a function that uploads an image and that works great. I love ..Nets built in upload, so much easier than 3rd party uploaders! Now I am making a public function that will take the...
6
by: David Stone | last post by:
I have a simple question about the alt content of area elements within an image map: is it redundant to include phrases such as "link to..." or "jump to..."? My initial thought is 'yes', since...
2
by: user | last post by:
Hi all... i am trying to print an image using GDI - but the only thing i get is a black rectangle. Does anybody know what is wrong, or how else to get the bitmap on the printer (GDI+ is not...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.