In this post, we will add a new project called "DigitalSim" to the solution. Right click on the solution name > Add > New Project... Name: DigitalSim. Set Digital Sim as the start up project. Change the name of Form1.cs to MainForm.cs.
MainForm Design
MainForm properties:
- Text: Digital Simulator
- StartPosition: CenterScreen
From the toolbox, add the following controls to the MainForm
- MenuStrip
- BackColor: LightSteelBlue
- MenuStrip Menu Items
- File
- New
- Load
- Save
- Exit
- ToolStrip
- BackColor: LightSteelBlue
- ToolStrip Buttons
- AND
- OR
- NOT
- Switch
- LED
- Wire
- Modern UI
- Picture Box
- Name: schematicCanvas
- BackColor: LightBlue
- Dock: Fill
MenuStrip Button Handlers
ToolStrip Button Handlers
PictureBox Event Handlers
Organizing Classes into Folders
This project will use folders to organize classes. Note that folders are also namespaces for C# classes. Add three new folders in the DigitalSim project:
- Circuits
- Components
- Wires
Circuit Class
Right click on the Circuits folder > Add > Class, Name: Circuit.cs. This class will manage schematics and provide analysis, file save, and file load functionality. Note that the namespace for this class includes the folder name.
Component Classes
Right click on the Components folder > Add > Class, Name: Comp.cs. This class is the base class for all digital components. It will include a list of wires connected to the component input and output ports.
Add the AND, OR, NOT, Switch, and LED classes to the components folder.
Wire Class
Right click on the Wires folder > Add > Class, Name: Wire.cs. Interconnections between digital components are wires.
No comments:
Post a Comment