Adding some visual pizazz to your WinForm world with Visual Drawing.Net

Description

Today's "I can't think of a way to make it rhyme with Monday" project by Erdal Halici is frankly pretty awesome. Not only do we get a very cool way to design shapes for our app's, we get to do it in an awesome Visual Studio design experience AND we get the source to everything too. Oh yeah, and he's created some nice documentation for the whole thing!

Visual Drawing.Net

Many years ago, when Microsoft .NET was newly released, I was working in a company as Software Consultant and I was in duty of helping our customers to jump start .net development and teach them the new .net programming languages C# and Visual Basic .NET in a condensed and structured way. Most of the developers I assisted were Visual Basic 6.0 developers and many of them were not very familiar with Object Oriented Programming and Design. I needed to find the best way to explain OOP. So, the best example to teach OPP was to use a base Shape class having a virtual Draw method and decorate this Shape class with all aspects of OOP. Next to this, I was also teaching them the design time features of Visual Studio .NET. After these workshops were completed and everyone in the world learned .NET, I had lots of shapes beside me; I decided to make something useful with them, which maybe would be useful to others. Thus, I developed a shape-development tool and a development environment that integrates with Visual Studio .NET.

After I started to work as a Software Architect for various companies in Germany in year 2004 and I had more responsibilities during my work life, I totally forgot that I developed this tool. Just recently, when I was looking to my file archives, I saw it again. I refreshed and updated it now that it also works with newer versions of Visual Studio .NET including Visual Studio 2008, 2010 and 2012. I hope you will like it. It is free and you can download the full source code on http://visualdrawingdotnet.codeplex.com and find the documentation under www.erdalhalici.com.

...

image

image

image

Background

Visual Drawing.Net is a shape-development tool providing a development environment that integrates with Visual Studio .NET 2005/2008/2010/20012 and all related express editions.

Visual Drawing.Net speeds up the development of graphical applications based on the vector graphics. All the shapes that are created using Visual Drawing.Net are programmable and their attributes and properties can be changed at any time during the run time of the containing application. Shapes are designed using object oriented programming paradigm supporting visual inheritance in the Visual Studio .NET 2005/2008/2010/2012 and all Express editions development environment.

Visual Drawing.Net is a shape-based drawing tool a wealth of built-in shapes that developers can drag onto the drawing surface to create drawings; many third-party tools for use in Visual Studio .NET are available as well. Sometimes, however, when no built-in or third-party shapes exist to solve a specific drawing problem, a shape developer must create custom shapes that have a particular appearance or behave in a certain way at any time. Once created, custom shapes become reusable components that can be used in applications or compiled into shape libraries to be used in the applications. The capacity to use programmable shapes is one of the features that make Visual Drawing.Net such a powerful drawing tool.

Developing a shape involves creating the geometry of the shape and specifying and implementing its behavior. By choosing the correct combination of geometry and behavior, a shape developer can create shapes that model the objects in the real world that they represent. Shape geometry refers to a shape’s appearance, and consists of the lines, angles, and formatting of a shape, and whether a shape is rotated. It also includes the way a shape is structured. Whether, for example, it is a simple shape or a shape container that groups several simple shapes together. You create shape geometry by drawing a shape, using the Visual Drawing.Net on design view. You can also create or extend shape geometry by writing code in the code view.

Why Use Visual Drawing.Net?
Some of the reasons for using Visual Drawing.Net to develop shapes are as follows:

  • Visual Drawing.Net is a development and productivity tool for developers who design and develop graphical applications. It provides a custom work environment that integrates with Visual Studio .NET 2003 and Visual Studio .NET 2005 and all Express editions to make it easier to specify, create, build, test, and maintain shapes.
  • Shapes are extendable. You can create your own shape by overriding the shape method MakePath and ones a Shape created, it can be used in the Shape Container. The Shape Container will provide design time support for your shape to rotate, shear, move, warp, shade, fill with a color or using a brush etc.
  • Visual Drawing.Net provides consistency in newly developed shapes. You could implement the same behavior in a variety of ways in the Shape Containers (for example, by using visual inheritance in all Visual Studio .NET and Express Editions). With Visual Drawing.Net, behaviors are applied the same way every time.
  • Visual Drawing.Net stores shapes in Shape Containers, which is also a Shape object and all attributes and behaviors associated with shapes you create independently using any .net supported programming language( C#, VB.Net etc.), making it easier for teams of designers, developers, and testers to work cooperatively, or for different aspects of shape creation to be handled by different teams or companies.

When to Use Visual Drawing.Net?
Use Visual Drawing.Net, when you want to do any of the following:

  • Create programmable shapes that have complex attributes and behaviors, such as multi-state shapes.
  • Create shapes that are part of a hierarchy of similar shapes or sets of shapes that have minor variations.
  • Create libraries of shapes and maintain them over time, including making changes to numerous shapes at the same time.
  • Be able to test shapes you have developed to ensure they implement specified behaviors correctly.
  • Create shapes as part of a shape-development team that divides labor amongst shape designers, developers, and testers, or outsource parts of the shape development process to other organizations.
  • Store shape information independently rather than in the applications in which the shapes are used.

....

The CodeProject article continues getting you started, adding shapes, etc.

The sample downloaded, compiled and ran for me with no problems, the first time.

Here's a snap;

image

image

I liked seeing samples in both C# and VB. Nice...

I mentioned documentation?

image

image

...

SNAGHTMLf1bdac3

I also mentioned source for the entire thing, and not just the CodeProject sample (which has the binaries for the real meaty part)?

Yep, just a CodePlex away...

image
http://visualdrawingdotnet.codeplex.com

Here's a snap of the actual component Solution (for which the latest check-in, as of the writing of this, compiled fine and easy..)

image

So again, you not only get a cool project, but all the source that makes up that project too!

The Discussion

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.