Skip to content

Repository files navigation

🎨 Simple Paint

A lightweight, beginner-friendly paint application built with C# and Windows Forms, letting you draw freely on a canvas with customizable colors and brush thickness.


📖 Overview

Simple Paint is a desktop drawing app where users can sketch freehand on a canvas using the mouse. It supports color selection, adjustable brush thickness, an eraser tool, background color changes, and the ability to save or open images — all through a clean, easy-to-use interface.


✨ Features

  • 🖌️ Freehand drawing on canvas using mouse movement
  • 🎨 Quick color selection (Black, Red, Blue, Green)
  • 🌈 Custom color picker via ColorDialog
  • 📏 Adjustable brush thickness via a slider (TrackBar)
  • 🧽 Toggleable eraser mode
  • 🗑️ Clear canvas button
  • 🖼️ Background color selection
  • 💾 Save drawing as a PNG image
  • 📂 Open an existing image onto the canvas
  • ✨ Smooth, anti-aliased strokes with rounded line caps and joins

🖼 Screenshots

Main Window

Main Window

Drawing Demo

Drawing Demo


🛠 Technologies Used

  • C#
  • Windows Forms (WinForms)
  • .NET Framework 4.8
  • GDI+ (System.Drawing)

📂 Project Structure

  • Program.cs — Application entry point; initializes and runs the main form.
  • Form1.cs — Core logic of the app: drawing, color/thickness handling, eraser, clear, save/open functionality.
  • Form1.Designer.cs — Auto-generated layout and control definitions for the main form.
  • Form1.resx — Resource file associated with the main form (e.g., embedded UI resources).
  • Properties/Resources.resx / Resources.Designer.cs — Strongly-typed resource class exposing embedded assets (e.g., the app icon bitmap).
  • Properties/Settings.settings / Settings.Designer.cs — Application settings scaffold generated by Visual Studio.
  • AssemblyInfo.cs — Assembly metadata (title, version, GUID, etc.).
  • App.config — Runtime configuration specifying the target .NET Framework version.
  • paint.ico — Application icon.
  • SimplePaint.csproj — Project file defining build settings and included files.
  • SimplePaint.sln — Visual Studio solution file.
  • images/ — Folder for README screenshots.

🚀 Getting Started

  1. Make sure you have Visual Studio installed with the .NET desktop development workload.
  2. Clone or download this repository.
  3. Open SimplePaint.sln in Visual Studio.
  4. Press F5 (or click Start) to build and run the application.
  5. Start drawing on the canvas with your mouse!

🎯 Learning Objectives

This project demonstrates the following Windows Forms and .NET concepts:

  • Event-driven programming (button clicks, mouse events, scroll events)
  • GDI+ drawing with Graphics, Pen, and Bitmap
  • Handling MouseDown, MouseMove, and MouseUp events to implement freehand drawing
  • Using a PictureBox as a drawing surface
  • ColorDialog for custom color selection
  • OpenFileDialog and SaveFileDialog for file I/O
  • TrackBar control for adjustable values
  • Anti-aliasing and line cap/join settings for smoother visuals

💡 Code Highlights

  • Drawing is done onto a persistent Bitmap (not directly on the control), ensuring strokes are preserved and redrawn correctly when the form refreshes.
  • SmoothingMode.AntiAlias combined with rounded LineCap and LineJoin settings gives strokes a smooth, continuous look instead of jagged segments.
  • Eraser mode reuses the drawing logic by simply switching the active color to the canvas background color.
  • Opening an image loads it into a new bitmap and stretches it to fit the canvas dimensions before displaying it.

📌 Possible Future Improvements

  • Shape drawing tools (rectangle, ellipse, line)
  • Undo / Redo functionality
  • Keyboard shortcuts for common actions
  • Export to additional image formats

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages