FILEDRAW: Read a File of Graphic Commands to Create a Graphic Image

1. Come to class as there may be corrections, changes and additions.
3. Follow these directions to create a C# WINDOWS program.
4. Follow these directions to SUBMIT a folder called "FILEDRAW" to your class account

Includes the use of files, loops, if statements and methods.

                                                              Program before executing                                                       Program (90% grade): Data file for this image (90 lines: 5C,9R,4E).

                                Program (90% grade) after reading large file and creating image                                 Program (100% grade) reading same file and showing stats.

      frmMain in Solution Explorer
      panDraw: Create a panel that is 500 by 500 (Size property: 500,500)

Methods - created by clicking on the controls in the designer btnFileProcess_Click() btnClear_Click() frmMain_Load() - created by creating your own method (optional - extra) (just type in the method OR Highlight Code / left margin/quick action/extract) SetColor() Rectangle() Ellipse() WriteText(int rct, int ell, int col)
Algorithm Read a file that will have the following structure: Command (R,E,C) followed by 4 integer numbers. R means rectangle 10 means x location 10 20 means y location 20 50 means width 50 60 means height 60 E means ellipse 20 means x location 20 30 means y location 30 90 means width 90 110 means height 110 C means color 100 means a 100 200 means r 200 150 means g 150 160 means b 160
Sample data file Color 3 Rectangles Color 2 Rectangles Color 4 Rectangles Color 2 Ellipses Color 2 Ellipses Small data file Large data file

 To add to project: 
     solution explorer
        right-click on the project
               new item
                  text file
                     change name to "DRAW.TXT"
                             change property - copy to output - always

. Declare at class level: Graphics object Brush drawing object StreamReader file reader object . frmMain Load create graphics object on panDraw focus on panDraw . Read File and Create Image button click open file File.OpenText("DRAW.TXT") (FILE MUST BE CALLED 'DRAW.TXT') loop while not at end of stream read from file if R Rectangle - use numbers to create rectangle else if E Ellipse - use numbers to create ellipse else if C SetColor - use numbers to create new brush end loop close file . Clear button Use gr.Clear() clears panel where graphics object has been created . Keep track of stats and write stats to panDraw using DrawString( 3 parameters ) method that you create - must pass in parameters // text Font myFont = new Font("Consolas", 14); gr.DrawString("Rectangle:" + r.ToString(), myFont, Brushes.Blue, 10, 380); -command - text to display - font - brush -x -y