View Single Post

  #1 (permalink)  
Old 02-09-2004
Anonymous Anonymous is offline
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
MegaPoints VS.NET Sample Project

Here's some VB.NET code taken straight from the "MegaPoints" client point-drawing example found at http://demo.mappoint.net/:

======================
Dim newBitmap As Bitmap
newBitmap = New Bitmap(ClientSize.Width, ClientSize.Height)

Dim graphics As Graphics
graphics = graphics.FromImage(newBitmap)

Dim mapBitmap As Bitmap
mapBitmap = New Bitmap(New MemoryStream(mapImages(0).MimeData.Bits))

graphics.DrawImage(mapBitmap, 0, 0)
DrawPushpins(graphics, POIPins)
PictureBox.Image = newBitmap
======================

This works just fine...for this Windows Forms project.

I'm working with the MapPoint Web Services SDK, though, and I'd like to do client-drawing and render it to my <img> object on my ASP.NET web page.

Any idea how I can do that?

In that "MegaPoints" example, they end up with a System.Drawing.Bitmap object. I have yet to find a way, however, to convert this to the byte array that my <img> object consumes via the MapImage.MimeData.Bits property:

======================
With Me.Response

Call .Cache.SetCacheability(HttpCacheability.NoCache)

Dim oMapImage As MapPointService.MapImage

Try
oMapImage = CType(Me.Session.Item("Map." & msPageID & ".MapImage"), MapPointService.MapImage)
Catch
oMapImage = Nothing
End Try

If (oMapImage Is Nothing OrElse oMapImage.MimeData Is Nothing) Then
.StatusCode = 404
Else
Call .Clear()
.ContentType = oMapImage.MimeData.MimeType
Call .BinaryWrite(oMapImage.MimeData.Bits)
Call .End()
End If

End With
======================

Thanks for any help on this. I'm striking out on Experts Exchange's .NET area with this question.
Reply With Quote