Graphics in C# and Visual Studio
Until my Introduction to Programming in C# course in the spring, I've been mainly
programming in Java. One of the biggest surprises of programming C# in the
.NET framework is the ability to visually create the graphics.
The .NET framework in Visual Studio allows you to click and drag the visual
components, the "controls," onto a blank template, called a "Form." The menu
that lists the controls is called the "Toolbox." Some controls of the Toolbox
include simple controls such as buttons, textboxes, labels; to more elaborate
controls such as DateTimePicker, PrintDocument, and many more.
After you drag and click the control onto the Form, the code is then created for you, with the object being instantiated and ready for use. You don't have to press a key to create graphics. Whereas in Java, you would need to set up the JFrame, JPanels, and layout; and then manually declare, instanitate, and add the visual components onto the JPanels.
For more information on getting started and documentation, you can visit Visual Studio's website.
Visual Studio
Temperature Report Application
Looking back on my programming classes, one of my favorite assignments was to create a
bar graph and a numerical list of the minimum, maximum, and average monthly temperatures
in Minneapolis in a random range of years, for up to the last 20 years. It's my favorite
because I felt like this was first time my application had looking professional.
The assignment entailed downloading a spreadsheet of Minneapolis temperature data from
a weather site. Then, we had to create a FileIO that could read and store the data in
a table. I had created my table using a List within a List.
Afterwards, I had created a method called "extrapolate()" which would retrieve the user
input for the yearly range and store it into a new table. Then, by parsing
the column with the month index, I stored the row into its appropriate month's
SortedList, which sorts the temperature data in order. The SortedList would
decrease the amount of time it took find the minimum, maximum, and average temperatures for each month.
Finally, after fixing the minutae in the current classes (data type conversions from String, adjusting
the Random generator for leap years, etc...). I learned how to use JavaFX, a set of graphics and media
packages, to create the professional-looking bar graph. Each month had three bars displaying the
minimum, maximum, and average temperature data. Another window would show the numerical minimum,
maximum, and average temperature data in their respective list, so the user could view the specific
numbers.
As you can see, this was one of the most exciting projects I've worked on.
I hope to do an assignment like this again someday.
If you'd like to see the assignment, I've posted a link below to download the zipped file.
Temperature Report Application