Visual GDI+ Question From WindowsForms Site

The following question was asked on the WinForms Discussion Group:

I think I wrote something about a graphics wish before, but it was way more advance than this one.

It will be nice if there was software or a part of Visual Studio.Net that acts like a graphics program were you can draw drawings and those drawing to be converted to code, and resource files.

So instead of spending long time drawing some parts of a custom control using the code, I can do the same thing much more faster using Visual GDI+, and use the automatically generated code.

Someone suggested metafiles, but I replied:

Actually, you can use something alot easier, and a bit more dynamic, Scalable Vector Graphics (SVG). SVG is an XML based language that discribes graphics in terms of vectors, and is very similar to GDI+. But there is no MS SVG to GDI+ rendering engine. So a group of us got together and created an open source project called SharpVectorGraphics (aka SVG# or SharpVectors). You can get a bunch of info off our site - www.sharpvectors.org, including a link to the code (currently on SourceForge, an open source site), and you can even demo it thru a web page I set up. There's a ton of code, a SVG DOM library, a SVG to GDI+ rendering Engine, and even a SVGPicture window that you can place in your WinForm.

We got most of the static SVG stuff done, and are working on Scripting and Event support (but that's alot more that what you were looking for).

What can you do with this now?  Create graphics on the fly using SVG templates. If you have a SVG template, you can take a data source and dynamically add more to the XML, and then pass it into the render and get back a GDI+ Graphics object completely rendered. From there you can do what you want with it. I use this method to create labels with bar codes dynamically, and then either render to the window, or to the printer.

Another cool thing about SVG is that it is supported by Adobe Illustrator. So you can let your graphic artist use there native tools to create the graphic templates, save them as SVG and then use them in your app. This way everyone works with their natural development tools.

Don XML

No Comments