A simple desktop calculator built with C# and Windows Forms (.NET Framework). This project demonstrates event-driven programming, GUI component layout, and basic logic structuring for arithmetic operations.
- Language: C# (.NET Framework)
- UI Framework: Windows Forms
- IDE: Visual Studio
- Design Pattern: Event-driven architecture
- Basic arithmetic:
+
,-
,×
,÷
- Decimal input support
CE
(Clear Entry) andC
(Clear All) functionality- Support for chaining operations
- Keyboard input handling
- Prevents invalid expressions (e.g., division by zero)
- Optional form resizing behavior
CalculatorWindows/
│
├── CalculatorWindows.sln # Visual Studio solution file
└── CalculatorWindows/
├── Form1.cs # Code-behind for UI logic (event handlers)
├── Form1.Designer.cs # Auto-generated UI layout and controls
├── Program.cs # Main entry point (Application.Run)
└── Resources/ # (Optional) Icons, fonts, or images
- Windows OS
- Visual Studio 2019 or later
- .NET Framework 4.x installed
-
Clone the repository:
git clone https://github.com/AmirAbdollahi/calculatorwindows.git
-
Open
CalculatorWindows.sln
in Visual Studio. -
Set
CalculatorWindows
as the startup project. -
Press
F5
to build and run.
This project currently supports manual testing. You can test it by:
- Clicking UI buttons in different sequences
- Entering decimals
- Dividing by zero
- Using both keyboard and mouse input
- Memory functionality (
MC
,MR
,M+
,M-
) - Parentheses handling
- Complete keyboard-only interaction
- Expression parsing engine
- History panel for past calculations
- Unit tests using MSTest, xUnit, or NUnit
Amir Abdollahi
GitHub Profile
This project is licensed under the MIT License.