Skip to content

0xsummerday/winforms-drawing-tool

Repository files navigation

Paint Application (C#)

A desktop drawing application built with C# and Windows Forms, inspired by the classic Microsoft Paint experience.

This project started as a hands-on challenge while learning C#, but it grew into a feature-rich WinForms app that covers drawing tools, shape rendering, text, image editing actions, selection workflows, and basic canvas manipulation. It was a practical way to learn event-driven programming, graphics rendering, and desktop UI development.

Features

Drawing Tools

  • Pencil / freehand drawing
  • Eraser
  • Airbrush
  • Straight line tool
  • Curve support
  • Text tool

Shapes

  • Rectangle
  • Ellipse / oval
  • Triangle
  • Right triangle
  • Polygon
  • Diamond
  • Pentagon
  • Hexagon
  • Right / left / up / down arrows
  • Four-point, five-point, and six-point stars
  • Rounded rectangle callout
  • Oval callout
  • Cloud callout
  • Heart
  • Lightning

Editing & Canvas Actions

  • Foreground and background color selection
  • Custom color editing
  • Adjustable pen/brush size
  • Fill and outline behavior
  • Color picker
  • Fill bucket
  • Open image
  • Insert image onto canvas
  • Save drawing
  • Undo / redo
  • Zoom in / zoom out
  • Crop
  • Flip horizontally / vertically
  • Rotate left / right
  • New canvas

Selection Support

  • Rectangular selection
  • Free-form selection
  • Resize/move workflow for selected content

Screenshots

image

Demo GIF

PaintDemo_2


Why I Built This

This was one of my early C# projects and an important milestone in my learning journey. I wanted to build something interactive that would help me understand how desktop applications respond to user input in real time.

The goal was not just to recreate a simple paint program, but to explore:

  • Event-driven programming in WinForms
  • Mouse-based drawing interactions
  • Rendering graphics with System.Drawing
  • Managing drawing state across tools
  • Building a more complete desktop UI with multiple editing actions

Tech Stack

  • Language: C#
  • Framework: .NET Framework 4.8
  • UI: Windows Forms (WinForms)
  • Graphics: System.Drawing
  • Project Type: Desktop application

Architecture Overview

The project is organized as a classic WinForms desktop app with drawing-specific helper classes.

Main Components

  • Form1.cs
    Contains the main UI logic, event handling, tool state, mouse interaction flow, canvas actions, and command behavior.

  • Draw.cs
    Encapsulates shape rendering logic for lines, polygons, arrows, stars, and custom callout-style shapes.

  • DoubleBufferedPanel.cs
    Enables double buffering to reduce flicker while drawing and repainting the canvas.

  • TinySquare.cs
    Supports selection/resize handles for interactive editing.

Rendering Model

The app uses Bitmap, Graphics, mouse events, and control repainting to provide a drawing surface that updates in real time as the user interacts with the canvas.

What I Learned

Working on this project helped me build confidence in:

  • WinForms UI design
  • Handling MouseDown, MouseMove, and MouseUp
  • Drawing with Graphics, Pen, Brush, and Bitmap
  • Building reusable drawing logic
  • Managing application state across multiple tools
  • Supporting editing actions like crop, rotate, flip, and zoom
  • Improving UI responsiveness with double buffering

Getting Started

Prerequisites

  • Windows
  • Visual Studio
  • .NET Framework 4.8 targeting pack

About

C# WinForms paint application with drawing tools, shape support, color fill, eraser, and image saving.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages