Downloads: Pencil Source (Visual Studio 2008, C#) [Zip]


Pencil is a simple notepad application written in C#. It has the following features:

  • draw vector strokes using a mouse or pen
  • efficient multi-stroke undo/redo by dragging left/right on the undo slider (the clock icon)
  • raster-style erasing of vector strokes (**see bugs list below)
  • multiple pages
  • save/load in XML format
  • infinite canvas (drag on translation buttons in the corners)

Here is a screenshot:

Pencil uses OpenGL to render the strokes (they are actually little dots drawn closely together, and the dots are drawn as textured quads). I used the Tao framework to access OpenGL from C#. Unfortunately, the Tao Framework has been discontinued as a project. As of time of writing, SourceForge still hosts Tao Framework v2.1.0. Download and unzip, and then update the References in the Visual Studio project to point to the Tao DLL's (they are in the bin\ folder of the zip).

Pencil uses VBTablet.Net to access WinTab, the tablet API library. This project also appears to be defunct (not updated since 2006). I include the source to VBTablet.Net in the Pencil distribution, it will build as part of Pencil. You may need to install Wacom drivers on your computer to access WinTab. Note that you will get much better drawing quality with a pen.

If you wanted to update the project to .NET 3.0, you would need to switch to OpenTK's OpenGL wrapper. This would be a bit of work, and you would have to disable some things (I think).

Note also that Pencil is built on a somewhat more extensive UI framework, that has support for some other interesting stuff. This framework may be useful for other UI prototyping projects.

Known Bugs

The Eraser tool can be a bit buggy, especially combined with undo/redo


This code is released under the Boost 1.0 License, so you can use it for any purpose, commercial or non-commercial.


Back To
DCS Logo
DGP Logo