Tuesday, March 19, 2024 03:11

Archive for 2017

GUI Controls

Tuesday, September 19th, 2017

Since we already learned about visual controls, their properties, events, and so on, it is time to learn the list of available controls for designing our graphical user interfaces. Note that the list is presented in alphabetical order, not by the importance of the controls, nor by the frequency of which they are used.… Read more

Control Events

Sunday, September 3rd, 2017

In computer programming, event-driven programming is a programming paradigm in which the flow of the execution of a program is determined by events such as user actions (mouse clicks, key presses), sensor outputs, or messages from other programs/threads.

Because C# is also an event-driven programming language, today we will learn about events.… Read more

Control Properties

Sunday, August 20th, 2017

At some point in my lessons, I was discussing how a class (object) can have properties and methods. I was also saying that the Controls that we are adding to our GUI’s are actually also objects (classes). Therefor, as you might have guessed, the graphical controls of our interfaces have control properties, through which we can customize their parameters.… Read more

XAML

Sunday, August 13th, 2017

XAML (Extensible Application Markup Language) is the language behind the visual presentation of an application that you develop in Microsoft Expression Blend, just as HTML is the language behind the visual presentation of a Web page. Though it is not this website’s purpose to teach XAML, and though programmers can develop a program’s interface almost entirely without knowing XAML, in this lesson I will talk briefly about what XAML is, what does it look like, what it does and how we can use it.… Read more

Graphical User Interface (GUI)

Thursday, August 10th, 2017

As explained in this lesson, we will create a new project, but this time we will not be using a console application template, but rather a WPF one, for the purpose of creating a graphical user interface (GUI) program. As explained in the yesterday lesson, there are more than one ways in which we can create GUI programs, but some of them are harder, or obsolete.… Read more

WPF

Thursday, August 3rd, 2017

Back in the day, in the golden days of prehistoric programming (~’80’s), programmers were writing programs that would only display text. Graphics were rare and hideous, and the majority of computer programs were as basics as it gets. Here is a screenshot of Lotus 123, which was a spreadsheet program used for financial jobs:

Up to this point, all the lessons I have taught you were exemplified using the same command line interface (CLI).… Read more

Namespaces

Wednesday, August 2nd, 2017

In OOP, namespaces are containers for a group of classes which have a common context or are categorized by common functionality. Namespaces do not have any kind of functionality, and it is not mandatory to use them. However, they offer a few advantages, most notably being the ability of sorting and grouping your code into logical units.… Read more

Bit masks and the Flags enumerations attribute

Sunday, July 16th, 2017

Most programmers use enums just so they can enforce a predefined set of options from which users can chose. However, enums have one major disadvantage: they can only hold one value at a time. Let’s say we have the following code:


In this case, specifying that we want to have a direction towards left seems OK.… Read more

Enumerations

Sunday, July 16th, 2017

Enumerations are structures which resemble classes but differ from them in that in the enum body we can declare only constants. A variety of logically connected constants can be linked by means of language. These language constructs are the so-called enumerated types.… Read more

Constants

Saturday, July 1st, 2017

Just like constants in mathematics, C# defines special fields of classes called constants. Like their name hints, once declared and initialized, constants maintain their values, forbidding their further modification.

There are two types of constants:

  • constants for which the value is set during the compilation (compile time constants)
  • constants which have their value set during the execution (run-time constants)

Compile time constants are declared using the C# modifier const:

A secret not many C# programmers know is that compile time constants are static fields, even if they do not contain the static keyword, and the compiler forbids its usage in the declaration.… Read more


Follow the white rabbit