Hi I am going to write a drawing tool for one of my client in phases, I thought I can share some of the learning with the community as this is a far different project that I always did. All my projects and expertise some how related to data centric and data visualization.
However, now I have chance to explorer some of the WPF animation, drawing and other interesting things like 2d, and 3d objects. In this short post I would share few line of code from my actual project where I have done a demo on drawing a line on a canvas.
In above example I have created a window to draw line upon the button clicks. Fairly simple and easy. Bellow the xaml definition is given.
Just a simple drawing surface named “DrawingPanel” which is a canvas. Bellow the c# code is given.
Here I have first created a line element and then set its properties, here stroke and position and border thickness property is been set. Finally added in the drawing panel. Note that the position is been changed each time as we don’t want to keep the same object in same location.
I would continue to add more feature in the project and hopefully learn many things, and would definitely share with the community.