Drawing images in asp.net

  • Thread starter Cory J. Laidlaw, Beyond01.com
  • Start date
C

Cory J. Laidlaw, Beyond01.com

Hi,

I am trying to draw a simple graph using ASP.NET without using a 3rd party
control.

I only want to draw a simple horizontal bar chart, save it to a JPG and
render it on my web form.

There are several articles using GDI(?) for this, but they all relate to
windows forms, not web forms. My attempts to convert it to using on a web
form aren't working too well.

Does anyone have an example of how to do this from ASP.NET? Help greatly
appreciated! Thanks!!

Cory

P.s. Here is my first shot at a prototype. as you can see, nothing happens...

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles Me.Load

Dim bmp As New Bitmap(200, 200)
Dim fg As Graphics = Graphics.FromImage(bmp)

fg.FillRectangle(Brushes.Aqua, 50, 50, 100, 100)

bmp.Save("Test.bmp")

Image1.ImageUrl = "test.bmp"


End Sub
 
C

Cor Ligthert[MVP]

Cory,

Creating yourself images on ASPNet is not as simple as in Windows Forms.

Every image in HTML has its own url, you can see that sometimes in your
browser.

This is a method how you can do it.

http://www.vb-tips.com/ServerClock.aspx

I think this is an outdated example I made some years ago.

If I would make this example new, then I certainly would try to do it with
Silverlight

Cor




"Cory J. Laidlaw, Beyond01.com"
 
C

Cor Ligthert[MVP]

Cory,

Creating yourself images on ASPNet is not as simple as in Windows Forms.

Every image in HTML has its own url, you can see that sometimes in your
browser.

This is a method how you can do it.

http://www.vb-tips.com/ServerClock.aspx

I think this is an outdated example I made some years ago.

If I would make this example new, then I certainly would try to do it with
Silverlight

Cor




"Cory J. Laidlaw, Beyond01.com"
 
C

Cory J. Laidlaw, Beyond01.com

Very good. I'll check these soltuions out.

Thanks both to you Patrice and Cor for your help! :)

Cory
 
C

Cory J. Laidlaw, Beyond01.com

Very good. I'll check these soltuions out.

Thanks both to you Patrice and Cor for your help! :)

Cory
 
H

Herfried K. Wagner [MVP]

Cor Ligthert said:
Creating yourself images on ASPNet is not as simple as in Windows Forms.

Every image in HTML has its own url, you can see that sometimes in your
browser.

This is a method how you can do it.

http://www.vb-tips.com/ServerClock.aspx

I think this is an outdated example I made some years ago.

If I would make this example new, then I certainly would try to do it with
Silverlight

Well, the sample could be optimized easily by changing the image format from
bitmap to GIF or PNG, for example. This would reduce the amount of data
which has to be transferred.
 
H

Herfried K. Wagner [MVP]

Cor Ligthert said:
Creating yourself images on ASPNet is not as simple as in Windows Forms.

Every image in HTML has its own url, you can see that sometimes in your
browser.

This is a method how you can do it.

http://www.vb-tips.com/ServerClock.aspx

I think this is an outdated example I made some years ago.

If I would make this example new, then I certainly would try to do it with
Silverlight

Well, the sample could be optimized easily by changing the image format from
bitmap to GIF or PNG, for example. This would reduce the amount of data
which has to be transferred.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top