Monthly Archives: November 2016

Make mazes with topographic features in C#

The example Make and draw a maze in C# shows how to use a random spanning tree algorithm to make mazes. This example shows how to modify the algorithm to make mazes that have specific topographic features. The previous example … Continue reading

Posted in algorithms, drawing, graphics, mathematics | Tagged , , , , , , , , , , , , , , | Leave a comment

Make and draw a maze in C#

This example shows how to generate and draw a maze. To create the maze, it uses a spanning tree algorithm. A spanning tree is a tree that connects all of the nodes in a network. The following steps show the … Continue reading

Posted in algorithms, drawing, graphics, mathematics | Tagged , , , , , , , , , , , | 1 Comment

Graph equations entered by the user in C#

This example draws a graph of an equation entered by the user by combining techniques from the following two posts: Evaluate numeric expressions that are entered by the user in C# Graph an equation in C# This example uses techniques … Continue reading

Posted in algorithms, drawing, graphics, mathematics, reflection | Tagged , , , , , , , , , , , | 2 Comments

Graph an equation in C#

This example uses the the following MakeGraph method to draw the graph. // Make the graph. private void MakeGraph() { // The bounds to draw. float xmin = -3; float xmax = 3; float ymin = -3; float ymax = … Continue reading

Posted in algorithms, drawing, graphics, mathematics | Tagged , , , , , , , , , , | Leave a comment

Find files in the startup directory in C#

In some programs you may want to find files that were installed with the program. One way to do that is to put the files in the program’s installation directory. Open the Project menu, select Add Existing Item, find the … Continue reading

Posted in directories, files | Tagged , , , , , , , , , , , , | Leave a comment

Evaluate numeric expressions that are entered by the user in C#

This example shows one way to evaluate mathematical expressions entered by the user at runtime. Enter a numeric expression involving x and y in the upper text box. Then enter values for x and y in the lower text boxes … Continue reading

Posted in algorithms, mathematics, miscellany, programs, reflection | Tagged , , , , , , , , , , , | Leave a comment

List the locations of special folders in C#

The System.Environment class’s SpecialFolders enumeration lists special folders such as System, Cookies, Desktop, and so forth. The class’s GetFolderPath method returns the full path for one of the special folders values. This program uses the following code to enumerate the … Continue reading

Posted in directories, files, system | Tagged , , , , , , , , , , , | 2 Comments

List languages that you can compile at runtime in C#

The example Run user-entered code in C# shows how to let the user enter C# code, compile at runtime, and execute the result, but how do you know what languages you can compile that way? You might guess C# and … Continue reading

Posted in algorithms, miscellany, programs, reflection | Tagged , , , , , , , , , , , , , , , , , | 1 Comment

Run user-entered code in C#

This example shows how to compile and run user-entered code at run time. The form includes the following using statements. using System.CodeDom.Compiler; using System.Reflection; The following code executes when you click the Run button. // Compile and execute the code. … Continue reading

Posted in algorithms, miscellany, programs, reflection | Tagged , , , , , , , , , , , , , , , , | 6 Comments

Display tooltips for ListView items in C#

This example shows how to display different tooltips for the items in a ListBox. When you move the mouse over an item in the ListBox, the program uses the following code to display a tooltip for it. // Display a … Continue reading

Posted in controls | Tagged , , , , , , , , , , , , | 1 Comment