Introduction
Today, we are going to create a simple application, actually a simple sheet designing tool. This tool gives the user the flexibility to design his sheets, reports, bills, invoices, and receipts (whatever.)
In this writing, we will refer to reports, bills, invoices, receipts, etc. with just the name sheets. For this, we will need to give a sheet a definition.
A sheet is just like an empty page (i.e. template) that contains sheet items. For example, a resume template is a sheet that has many items (name, birth date, address, etc.) A cash receipt is a sheet that has a few items (date, amount, charged to, received by, etc.)
We will go through this tool in a nice way. We will begin by a very simple system analysis and application design. After that, we will get into coding.
Actually, I'm not an architect, and I think I will never be. So please, DO NOT blame me for this bad analysis. It is just an illustration to get you have a solid understanding of what our application is designed for.
Problem
The user is tied into the sheet designs that the developer has created for him. The user should have the ability to design his own sheets and/or to edit application defined sheets.
Requirements
User Requirements
The following is list of common user requirements:
- The application should allow the user to create, edit, and delete sheets, and to group those sheets into categories he creates.
- For the sake of simplicity, those categories would be only one level, no nested categories are allowed.
- The application should be persistent. The data should be stored in a database and loaded when the user needs it.
- The sheet should be loaded with right data and printed whenever the user asks.
- Like Visual Studio, the user should have a Toolbox that has all types of sheet items. The user could insert a sheet item into his sheet by drawing it into the screen, dragging it from the toolbox, or just double-clicking its icon in the toolbox.
- The user should have a ruler to allow him measuring sheet item dimensions. In addition, he should have a design-time-only grid.
- The user should be allowed to set attributes of the sheet like the page setup, grid settings, background color, etc.
- Not all sheet attributes are printed out; some are for design-mode only (like background color, and grid.)
- Each type of sheet items should have its own attributes and the user should be allowed to change them too.
- The user should be allowed to drag sheet items around the screen and position them.
- The user should be allowed to cut, copy, paste, and delete sheet items.
- Of course, the user should be allowed to print out the sheet, and to preview it too.
- The application should be generic to be used in any system and in any application.
- Other pieces of the system should have the possibility to interact with the sheet.
Functional Requirements
Common functional (developer) requirements are:
- Abstraction. Component/Class abstraction should be considered into the design. The system should consist of several components each of which groups a related features together (e.g. interface objects, business objects, and data management.)
- Extensibility. The system should be extensible. A good class hierarchy should be created, and derivation (inheritance) should be taken into consideration. In addition, every sheet item should be represented by a class in this hierarchy.
- Technically, sheet items would be called shapes. Because they are just drawings into the sketch (or sheet.)
- To allow the user to work with sheet items (shapes) and the application to populate the sheet with data, sheet items should not be drawn directly into the sheet page. Instead every item should represented by a class that has its own drawing routine.
- The sheet should be a container for the shapes. All shapes are children of the sheet.
- The sheet and rulers should be Windows controls to allow them to be hosted by a Windows Form.
- Sheet items should be Windows controls too to allow them to be hosted by the sheet.
- The sheet items should be owner-drawn controls and they should not be derived from existing Windows controls to help integrating them easily into the sheet.
- For the sake of simplicity, the sheet and shapes should be serialized into XML and stored in the database.
- The database should be a SQL Server database to allow faster communication and easier manipulation of XML data.
- The database should have three tables for the three core system components, the category, the sheet, and the shape.
- Every sheet item in a given sheet should have a unique name (or a tag) to allow other system components to interact with it (e.g. populate it with the right data.)
- The developer should have the ability to control the quality of the painting process for each control or item independently.
Solution
After going through project requirements and considering a sophisticated system design, we got a nice plan for our project that would be called Geming SISC (Sheet Infrastructure Components.)
This project would be created using C# and .NET 2.0 (or future versions of course.)
Snapshots
The following are final snapshots of the application. Figure 1 shows a cash receipt sheet designed by labels, boxes, and lines. Figure 2 shows a simple resume template designed by only a few labels and a picture. The left pane of the application lists current sheets grouped by their categories.
Component Design
Figure 3 shows the three components of our system.
- Geming.Sisc.Infrastructure:
Contains the sheet control and shapes controls (label, text box, etc.) The sheet, rulers, and sheet items controls are all derived from System.Windows.Forms.Control. - Geming.Sisc.Data:
Business objects that would be sent to the data among database manager objects. This component references the Geming.Sisc.Infrastructure component. - Geming.Sisc.Driver:
The application interface that would be used to design sheets. It references the other two components.
Class Diagrams
Extensibility is one of the main goals of the system. A flexible class hierarchy should be considered as well as derivation (i.e. inheritance) of controls for other external objects.
The following is the class hierarchy for the sheet and the ruler controls.



Gowtham RajamanickamPosted Apr 12, 2016, 2:13 AM
Good One, Thanks for sharing
ameeraPosted Jul 13, 2010, 9:49 AM
Images in the resource folder are missing in Gems.Sisc.Driver. Can you please upload the complete code