473,549 Members | 2,628 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

can one convert drawable XmlSerializer xmlns file into GIF or PNG?

Joe
this file is drawn in VB.NET and input output goes by XmlSerializer.
Therefore, simple output file looks like:

<?xml version="1.0" encoding="utf-8"?>
<DrawablePictur e xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http ://www.w3.org/2001/XMLSchema" BackColor="-1250856">
<DrawableRectan gle LineWidth="2" X1="377" Y1="88" X2="323" Y2="130"
ForeColor="-16777216" BackColor="-1" />
</DrawablePicture >
I would like to show it through webpage, but before I need to convert
it into GIF, PNG or any web-image readable file.

Can somebody please put some light on this issue? How would you
achieve that?
Thank you so much!
Jun 27 '08 #1
14 1870


"Joe" <jo*****@tlen.p lwrote in message
news:f4******** *************** ***********@m44 g2000hsc.google groups.com...
this file is drawn in VB.NET and input output goes by XmlSerializer.
Therefore, simple output file looks like:

<?xml version="1.0" encoding="utf-8"?>
<DrawablePictur e xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http ://www.w3.org/2001/XMLSchema" BackColor="-1250856">
<DrawableRectan gle LineWidth="2" X1="377" Y1="88" X2="323" Y2="130"
ForeColor="-16777216" BackColor="-1" />
</DrawablePicture >
I would like to show it through webpage, but before I need to convert
it into GIF, PNG or any web-image readable file.

Can somebody please put some light on this issue? How would you
achieve that?
Thank you so much!
If you can create an image you don't have to create a file to display the
info on a webpage.

What you want to do is the following:

1. Create a new aspx page in your website
2. For the URL on any page which needs your image set it to the newly
create aspx page. Using the QueryString you can then pass info to the page
which it will use to create an image. You will then write to the Response
object the image. This will allow you to dynamically create images on the
page without actually creating image files.

I have an example of this. I have a button which I use as a Jukebox button.
Rather than creating different ones for each "track number" I simple create
a bitmap using the background of the button and then impose the track number
as text.

Example:

Option Strict On
Option Explicit On

Imports System
Imports System.Drawing
Imports System.Drawing. Imaging
Imports System.IO
Imports MusicSiteContro ls

Partial Class DynamicImage
Inherits System.Web.UI.P age

Public Const imText As String = "ImageText"
Public Const imFolder As String = "ImageFolde r"

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArg s) Handles Me.Load
Dim imageFolder As String
Dim imageText As String
Dim bm As Bitmap
Dim ms As MemoryStream

imageFolder = Request.QuerySt ring(imFolder)
imageText = Request.QuerySt ring(imText)

If imageFolder Is Nothing Then
bm = makeImage(image Text)
Else
bm = makeImage(image Folder, imageText)
End If

If bm Is Nothing Then
bm = New Bitmap(Server.M apPath("~/Images/no-file-32x32.png"))
End If

ms = New MemoryStream
bm.Save(ms, ImageFormat.Jpe g)
Response.Conten tType = "image/jgp"
Response.Binary Write(ms.ToArra y())
End Sub

Private Function makeImage(ByVal imagetext As String) As Bitmap
Dim bm As Bitmap
Dim g As Graphics
Dim bfont As Font

Dim tsize As SizeF
'Dim imageHeight As Integer
'Dim imageWidth As Integer

bfont = New Font("Trebuchet MS", 14)

bm = New Bitmap(Server.M apPath("~/Images/TrackBackground .png"))

g = Graphics.FromIm age(bm)
tsize = g.MeasureString (imagetext, bfont)

Dim tx As Single
Dim ty As Single

tx = (bm.Width - tsize.Width) / 2
ty = (bm.Height - tsize.Height) / 2

g.DrawString(im agetext, bfont, New SolidBrush(Colo r.Black), tx, ty)
g.Dispose()

Return bm

End Function

Private Function makeImage(ByVal imageFolder As String, ByVal imagetext
As String) As Bitmap
Dim bm As Bitmap
'Dim g As Graphics
Dim bfont As Font

'Dim tsize As SizeF
'Dim imageHeight As Integer
'Dim imageWidth As Integer

bfont = New Font("Trebuchet MS", 10)
Dim d As New DAL
Dim folderName As String = d.GetImageFile( CInt(imageFolde r))

Dim fn() As String = Directory.GetFi les(folderName, "*.jpg")
If fn.Length = 0 Then
bm = Nothing
Return bm
End If

bm = New Bitmap(fn(0))

'Dim myImg As Bitmap
'Dim myCallback As System.Drawing. Image.GetThumbn ailImageAbort
'Dim myPtr As IntPtr
'myImg = DirectCast(bm.G etThumbnailImag e(32, 32, myCallback, myPtr),
Bitmap)
'g = Graphics.FromIm age(bm)
'g.DrawString(i magetext, bfont, New SolidBrush(Colo r.Black), 2, 2)
'g.Dispose()

Return bm
End Function
End Class
Hope this helps
Lloyd Sheen

Jun 27 '08 #2
Joe
On Apr 14, 1:28*pm, "Lloyd Sheen" <a...@b.cwrot e:
"Joe" <joe1...@tlen.p lwrote in message

LLoyd, your solution would work out, if not that: 1) I have an
application to draw (like a diagram thing), this application is
perfect but dumps result into that xmlns file... I am just simply
trying to read it back into some GIF file....
Jun 27 '08 #3

"Joe" <jo*****@tlen.p lwrote in message
news:d0******** *************** ***********@y21 g2000hsf.google groups.com...
On Apr 14, 1:28 pm, "Lloyd Sheen" <a...@b.cwrot e:
"Joe" <joe1...@tlen.p lwrote in message

LLoyd, your solution would work out, if not that: 1) I have an
application to draw (like a diagram thing), this application is
perfect but dumps result into that xmlns file... I am just simply
trying to read it back into some GIF file....

That is the point. You have a file with instuctions on how to create the
graphic. So the aspx file would take the filename as a querystring and then
create the graphic (could be a gif) and pass that to the repsonse. In
reality that is what is being done with a straight gif URL.

LS

Jun 27 '08 #4
Joe
On Apr 14, 2:21*pm, "Lloyd Sheen" <a...@b.cwrot e:
"Joe" <joe1...@tlen.p lwrote in message

news:d0******** *************** ***********@y21 g2000hsf.google groups.com...
On Apr 14, 1:28 pm, "Lloyd Sheen" <a...@b.cwrot e:
"Joe" <joe1...@tlen.p lwrote in message

LLoyd, your solution would work out, if not that: 1) I have an
application to draw (like a diagram thing), this application is
perfect but dumps result into that xmlns file... I am just simply
trying to read it back into some GIF file....

That is the point. *You have a file with instuctions on how to create the
graphic. *So the aspx file would take the filename as a querystring and then
create the graphic (could be a gif) and pass that to the repsonse. *In
reality that is what is being done with a straight gif URL.

LS
ok, so I need a script that will "read" xmlns file and create an image
file according to content.
Rather than having every function being rewritten by myself, I am
looking for a library (script) that already does that....

Jun 27 '08 #5

"Joe" <jo*****@tlen.p lwrote in message
news:e2******** *************** ***********@b1g 2000hsg.googleg roups.com...
On Apr 14, 2:21 pm, "Lloyd Sheen" <a...@b.cwrot e:
"Joe" <joe1...@tlen.p lwrote in message

news:d0******** *************** ***********@y21 g2000hsf.google groups.com...
On Apr 14, 1:28 pm, "Lloyd Sheen" <a...@b.cwrot e:
"Joe" <joe1...@tlen.p lwrote in message

LLoyd, your solution would work out, if not that: 1) I have an
application to draw (like a diagram thing), this application is
perfect but dumps result into that xmlns file... I am just simply
trying to read it back into some GIF file....

That is the point. You have a file with instuctions on how to create the
graphic. So the aspx file would take the filename as a querystring and
then
create the graphic (could be a gif) and pass that to the repsonse. In
reality that is what is being done with a straight gif URL.

LS
ok, so I need a script that will "read" xmlns file and create an image
file according to content.
Rather than having every function being rewritten by myself, I am
looking for a library (script) that already does that....
Where do you get these files from? It looks like (but I know it isn't) a
metafile with commands used to draw images. Googling I find a Scilab
graphics class. Does your app have a reference to this. If so I would
think there might be methods in the class library which would take the info
and draw a graphic.

And not to be a traffic cop here but deleting part of the thread makes
responding difficult for me and most likely impossible for others who join
late.

LS

Jun 27 '08 #6
Joe
On Apr 14, 2:53*pm, "Lloyd Sheen" <a...@b.cwrot e:
"Joe" <joe1...@tlen.p lwrote in message

news:e2******** *************** ***********@b1g 2000hsg.googleg roups.com...
On Apr 14, 2:21 pm, "Lloyd Sheen" <a...@b.cwrot e:


"Joe" <joe1...@tlen.p lwrote in message
news:d0******** *************** ***********@y21 g2000hsf.google groups.com...
On Apr 14, 1:28 pm, "Lloyd Sheen" <a...@b.cwrot e:
"Joe" <joe1...@tlen.p lwrote in message
LLoyd, your solution would work out, if not that: 1) I have an
application to draw (like a diagram thing), this application is
perfect but dumps result into that xmlns file... I am just simply
trying to read it back into some GIF file....
That is the point. You have a file with instuctions on how to create the
graphic. So the aspx file would take the filename as a querystring and
then
create the graphic (could be a gif) and pass that to the repsonse. In
reality that is what is being done with a straight gif URL.
LS

ok, so I need a script that will "read" xmlns file and create an image
file according to content.
Rather than having every function being rewritten by myself, I am
looking for a library (script) that already does that....

Where do you get these files from? *It looks like (but I know it isn't) a
metafile with commands used to draw images. *Googling I find a Scilab
graphics class. *Does your app have a reference to this. *If so I would
think there might be methods in the class library which would take the info
and draw a graphic.

And not to be a traffic cop here but deleting part of the thread makes
responding difficult for me and most likely impossible for others who join
late.

LS- Hide quoted text -

- Show quoted text -
I am sorry for not providing you more info. I need a simple "map"
drawing functionality and this resource is a perfect solution:
http://www.vb-helper.com/howto_net_d...framework.html

the only problem is that this outputs PIC XMLserialize file instead of
a GIF/PNG file which I am trying to achieve...
Thank you.

Jun 27 '08 #7

"Joe" <jo*****@tlen.p lwrote in message
news:c2******** *************** ***********@e67 g2000hsa.google groups.com...
On Apr 14, 2:53 pm, "Lloyd Sheen" <a...@b.cwrot e:
"Joe" <joe1...@tlen.p lwrote in message

news:e2******** *************** ***********@b1g 2000hsg.googleg roups.com...
On Apr 14, 2:21 pm, "Lloyd Sheen" <a...@b.cwrot e:


"Joe" <joe1...@tlen.p lwrote in message
news:d0******** *************** ***********@y21 g2000hsf.google groups.com...
On Apr 14, 1:28 pm, "Lloyd Sheen" <a...@b.cwrot e:
"Joe" <joe1...@tlen.p lwrote in message
LLoyd, your solution would work out, if not that: 1) I have an
application to draw (like a diagram thing), this application is
perfect but dumps result into that xmlns file... I am just simply
trying to read it back into some GIF file....
That is the point. You have a file with instuctions on how to create the
graphic. So the aspx file would take the filename as a querystring and
then
create the graphic (could be a gif) and pass that to the repsonse. In
reality that is what is being done with a straight gif URL.
LS

ok, so I need a script that will "read" xmlns file and create an image
file according to content.
Rather than having every function being rewritten by myself, I am
looking for a library (script) that already does that....

Where do you get these files from? It looks like (but I know it isn't) a
metafile with commands used to draw images. Googling I find a Scilab
graphics class. Does your app have a reference to this. If so I would
think there might be methods in the class library which would take the
info
and draw a graphic.

And not to be a traffic cop here but deleting part of the thread makes
responding difficult for me and most likely impossible for others who join
late.

LS- Hide quoted text -

- Show quoted text -
I am sorry for not providing you more info. I need a simple "map"
drawing functionality and this resource is a perfect solution:
http://www.vb-helper.com/howto_net_d...framework.html

the only problem is that this outputs PIC XMLserialize file instead of
a GIF/PNG file which I am trying to achieve...
Thank you.
Have you downloaded the framework that is pointed at in the web page? If so
is there a method to draw the graphics? The first method on the page
mentions a Draw routine which takes a Graphics object as a parameter. In
the sample I provided you will notice that it uses a Graphics object to draw
on.

A combination of the two should do the job.

Lloyd Sheen

Jun 27 '08 #8
Joe
On Apr 14, 3:52*pm, "Lloyd Sheen" <a...@b.cwrot e:
"Joe" <joe1...@tlen.p lwrote in message

news:c2******** *************** ***********@e67 g2000hsa.google groups.com...
On Apr 14, 2:53 pm, "Lloyd Sheen" <a...@b.cwrot e:


"Joe" <joe1...@tlen.p lwrote in message
news:e2******** *************** ***********@b1g 2000hsg.googleg roups.com...
On Apr 14, 2:21 pm, "Lloyd Sheen" <a...@b.cwrot e:
"Joe" <joe1...@tlen.p lwrote in message
>news:d0******* *************** ************@y2 1g2000hsf.googl egroups.com....
On Apr 14, 1:28 pm, "Lloyd Sheen" <a...@b.cwrot e:
"Joe" <joe1...@tlen.p lwrote in message
LLoyd, your solution would work out, if not that: 1) I have an
application to draw (like a diagram thing), this application is
perfect but dumps result into that xmlns file... I am just simply
trying to read it back into some GIF file....
That is the point. You have a file with instuctions on how to create the
graphic. So the aspx file would take the filename as a querystring and
then
create the graphic (could be a gif) and pass that to the repsonse. In
reality that is what is being done with a straight gif URL.
LS
ok, so I need a script that will "read" xmlns file and create an image
file according to content.
Rather than having every function being rewritten by myself, I am
looking for a library (script) that already does that....
Where do you get these files from? It looks like (but I know it isn't) a
metafile with commands used to draw images. Googling I find a Scilab
graphics class. Does your app have a reference to this. If so I would
think there might be methods in the class library which would take the
info
and draw a graphic.
And not to be a traffic cop here but deleting part of the thread makes
responding difficult for me and most likely impossible for others who join
late.
LS- Hide quoted text -
- Show quoted text -

I am sorry for not providing you more info. I need a simple "map"
drawing functionality and this resource is a perfect solution:http://www.vb-helper.com/howto_net_d...framework.html

the only problem is that this outputs PIC XMLserialize file instead of
a GIF/PNG file which I am trying to achieve...

Thank you.

Have you downloaded the framework that is pointed at in the web page? *If so
is there a method to draw the graphics? *The first method on the page
mentions a Draw routine *which takes a Graphics object as a parameter. *In
the sample I provided you will notice that it uses a Graphics object to draw
on.

A combination of the two should do the job.

Lloyd Sheen- Hide quoted text -

- Show quoted text -
they would... but it does not use Graphics object... it use
XMLSerialize to write into file and back from it only coordinance of
each objects... it is not a picture, it is a group of XML serialized
shapes... :(

Jun 27 '08 #9

"Joe" <jo*****@tlen.p lwrote in message
news:4d******** *************** ***********@l42 g2000hsc.google groups.com...
On Apr 14, 3:52 pm, "Lloyd Sheen" <a...@b.cwrot e:
"Joe" <joe1...@tlen.p lwrote in message

news:c2******** *************** ***********@e67 g2000hsa.google groups.com...
On Apr 14, 2:53 pm, "Lloyd Sheen" <a...@b.cwrot e:


"Joe" <joe1...@tlen.p lwrote in message
news:e2******** *************** ***********@b1g 2000hsg.googleg roups.com...
On Apr 14, 2:21 pm, "Lloyd Sheen" <a...@b.cwrot e:
"Joe" <joe1...@tlen.p lwrote in message
>news:d0******* *************** ************@y2 1g2000hsf.googl egroups.com...
On Apr 14, 1:28 pm, "Lloyd Sheen" <a...@b.cwrot e:
"Joe" <joe1...@tlen.p lwrote in message
LLoyd, your solution would work out, if not that: 1) I have an
application to draw (like a diagram thing), this application is
perfect but dumps result into that xmlns file... I am just simply
trying to read it back into some GIF file....
That is the point. You have a file with instuctions on how to create
the
graphic. So the aspx file would take the filename as a querystring and
then
create the graphic (could be a gif) and pass that to the repsonse. In
reality that is what is being done with a straight gif URL.
LS
ok, so I need a script that will "read" xmlns file and create an image
file according to content.
Rather than having every function being rewritten by myself, I am
looking for a library (script) that already does that....
Where do you get these files from? It looks like (but I know it isn't) a
metafile with commands used to draw images. Googling I find a Scilab
graphics class. Does your app have a reference to this. If so I would
think there might be methods in the class library which would take the
info
and draw a graphic.
And not to be a traffic cop here but deleting part of the thread makes
responding difficult for me and most likely impossible for others who
join
late.
LS- Hide quoted text -
- Show quoted text -

I am sorry for not providing you more info. I need a simple "map"
drawing functionality and this resource is a perfect
solution:http://www.vb-helper.com/howto_net_d...framework.html

the only problem is that this outputs PIC XMLserialize file instead of
a GIF/PNG file which I am trying to achieve...

Thank you.

Have you downloaded the framework that is pointed at in the web page? If
so
is there a method to draw the graphics? The first method on the page
mentions a Draw routine which takes a Graphics object as a parameter. In
the sample I provided you will notice that it uses a Graphics object to
draw
on.

A combination of the two should do the job.

Lloyd Sheen- Hide quoted text -

- Show quoted text -
they would... but it does not use Graphics object... it use
XMLSerialize to write into file and back from it only coordinance of
each objects... it is not a picture, it is a group of XML serialized
shapes... :(
Is there no implementation of the Draw method in the framework?
Jun 27 '08 #10

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

Similar topics

3
4169
by: Integer Software | last post by:
Hi. I have a really simple set of classes that writes 2 pathnames to a xml file. I can write the default ok. Then if I change 1 pathname to a shorter one, then rewrite the xml file, the remains of the old pathname, and closing tags are left on the end resulting in an invalid XML file. XmlSerializer.Deserialize gives a...
5
5409
by: Stuart Robertson | last post by:
I am trying to find a solution that will allow me to use XmlSerializer to serialize/deserialize a collection of objects where a given object is shared between two or more other objects, and not create duplicate XML representations of the shared object, but instead use IDREFs to refer to the shared object. The XML I'm trying to produce is as...
8
3550
by: Harris Boyce | last post by:
Hello, I'm trying to use the FOR XML EXPLICIT clause with SQL Server to deserialize data from my database into a strongly-typed collection object that I will use throughout my application. I initially tested my design by building a collection in code and then serializing it to/from an XML file, which worked fine. However, I have hit a...
4
11355
by: Andy Neilson | last post by:
I've run across a strange behaviour with XmlSerializer that I'm unable to explain. I came across this while trying to use XmlSerializer to deserialize from a the details of a SoapException. This should have worked fine since the class in question was already being serialized and deserialized as part of a Web service interface. What I found was...
2
942
by: magister | last post by:
Hello I got this working but it is not how I really want it, basically I have an xml file which has a root of <test> and can be filled with 3 different types of <question> elements with different attributes, all share a base set of 4, one of the question types can have children with <option> elements, this is how the xml looks after...
1
5111
by: Yewen Tang | last post by:
I have a schema file datamodel.xsd, element "properties" is declared as a type of "baseProperty". The schema file also defines "derivedProperty" is a derived type of "baseProperty". <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:myns="uri:myschema" targetNamespace="uri:myschema"...
2
18409
by: grochmal | last post by:
I am trying to use XmlSerializer to serialize a class I have created specifically for generating an XML file. The problem is that the XML file must contain a xsi:schemaLocation attribute in my root node but I can't figure out any way to do it. Here is what the resulting XML file must look like (small sample): <TXLife...
0
2791
by: theonlydavewilliams | last post by:
Hi there I'm hoping there's an easy answer to a (hopefully) not too long-winded issue... I'm building a C# web client using a proxy wsdl.exe'd from a wsdl file and six schemas, each in a different namespace. Some schemas extend complex types in others. When i get a soap:Fault from my test server it could contain a serialized exception object...
0
7541
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7734
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7979
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7497
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7826
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5385
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3512
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3493
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1960
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.