Im new to gdi+ and Im trying to plot 6x6 pixel ellipses on a map to show positioning. The problem is that I am not able to plot the ellipse precisely to my expected x,y coordinates. It it plotting high and to the left. Any suggestions?
here is my code:
Thanks!
here is my code:
Code:
Dim firstPoint As Boolean = True
Dim mapName As String
myRead = myCom.ExecuteReader
Dim oCanvas As Bitmap
Dim g As Graphics
Do While myRead.Read
If firstPoint = True Then
firstPoint = False
mapName = myRead.Item("map_name")
We load an existing bitmap
oCanvas = CType(Image.FromFile(Server.MapPath("library/images/maps/" + mapName)), Bitmap)
g = Graphics.FromImage(oCanvas)
g.ResetTransform()
***********Draw points on map ***************************************
g.FillEllipse(Brushes.Red, myRead.Item("x_coor"), myRead.Item("y_coor"), 6, 6)
g.ResetTransform()
Else
If mapName = myRead.Item("map_name") Then
g.FillEllipse(Brushes.Black, myRead.Item("x_coor"), myRead.Item("y_coor"), 6, 6)
g.ResetTransform()
Else
Exit Do
End If
End If
Loop
********************************************************************
resize the image
Dim mapWidth = oCanvas.Width * 0.75
Dim mapHeight = oCanvas.Height * 0.75
output new image with different size
Dim outputBitMap As Bitmap = New Bitmap(oCanvas, mapWidth, mapHeight)
Response.ContentType = "image/jpeg"
outputBitMap.Save(Response.OutputStream, ImageFormat.Jpeg)
Response.End()
Cleanup
g.Dispose()
oCanvas.Dispose()
f1.Dispose()
f3.Dispose()
Thanks!
Last edited by a moderator: