Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help wih Dynamic Image using XML feed

Status
Not open for further replies.

mikecx

Technical User
Jul 9, 2002
215
US
So far I believe I have the code right to open the connection to the xml file and I have the code right to make the image. All I need to do is figure out how to get the first line of the 10 line xml file to display in the spot I want it to.

Code:
<%@ Page ContentType=&quot;image/gif&quot; %>
<%@ Import namespace=&quot;System.Drawing&quot; %>
<%@ Import namespace=&quot;System.Drawing.Imaging&quot; %>
<%@ Import namespace=&quot;System.Data&quot; %>
<Script Runat=&quot;Server&quot;>
Sub Page_Load
	Dim objBitmap As Bitmap
	Dim objGraphics As Graphics
	Dim myDataSet as New DataSet()
		' create data connection
			myDataSet.ReadXML(Server.MapPath(&quot;test.xml&quot;))
			dgMBM.DataSource = myDataSet		
			dgMBM.DataBind()
		' Create Bitmap
			objBitmap = New Bitmap( 600, 20 )
		' Initialize Graphics Class
			objGraphics = Graphics.FromImage( objBitmap )
			objGraphics.Clear(Color.White)
		' Display Bitmap
			objGraphics.DrawString(&quot;Time:&quot;, New Font(&quot;Times New Roman&quot;, 12, FontStyle.Regular), SystemBrushes.WindowText, New PointF(0, 0))
			objGraphics.DrawString(&quot;Case Temp:&quot;, New Font(&quot;Times New Roman&quot;, 12, FontStyle.Regular), SystemBrushes.WindowText, New PointF(110, 0))
			objGraphics.DrawString(&quot;CPU Temp:&quot;, New Font(&quot;Times New Roman&quot;, 12, FontStyle.Regular), SystemBrushes.WindowText, New PointF(230, 0))
			objGraphics.DrawString(&quot;60gig hd Temp:&quot;, New Font(&quot;Times New Roman&quot;, 12, FontStyle.Regular), SystemBrushes.WindowText, New PointF(340, 0))
			objGraphics.DrawString(&quot;Cpu Fan:&quot;, New Font(&quot;Times New Roman&quot;, 12, FontStyle.Regular), SystemBrushes.WindowText, New PointF(480, 0))
			objBitmap.Save( Response.OutputStream, ImageFormat.Gif )
End Sub
</Script>
<asp:datagrid id=&quot;dgMBM&quot; runat=&quot;server&quot; />

If you need more info I can give you just about all the info anybody who doesn't suck at ASP.net (unlike me) could need. Thanks.
 
BTW, i'm trying to make a dynamic image with ASP.net using an auto generated xml file.
 
Anyone? I've looked at ADO.net tutorials and can't find out how to do it like I could in asp. All I need to do is connect to the XML file ( test.xml ) , read the first line and figure out what the new command that used to be Rs(1), Rs(2) is.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top