Monthly Archives: April 2016

Find an image URI in a WPF program in C#

One of the more annoying changes introduced in WPF and XAML is the image URI. Now instead of simply selecting an file from a resource, you need to supply an arcane string such as: pack://application:,,,/howto_wpf_learn_uri;component/csharp_prog_ref.png It’s another case of WPF’s … Continue reading

Posted in files, wpf, XAML | Tagged , , , , , , , , , | 1 Comment

Remove tabs from a WPF TabControl at runtime in C#

The example Add tabs to a WPF TabControl at runtime in C# shows how you can add tabs to a control at runtime. You would think removing tabs would be easier, and it is in a way. You simply remove … Continue reading

Posted in controls, user interface | Tagged , , , , , , , , , , , , | Leave a comment

Add tabs to a WPF TabControl at runtime in C#

When you click the + button, this example uses the following code to add a tab to the WPF TabControl named tabMain. // Add a tab to the TabControl. private void btnAdd_Click(object sender, RoutedEventArgs e) { TabItem tab_item = new … Continue reading

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

Use the is operator in C#

The is operator lets you determine whether you can convert an object to a particular type. For example, suppose the Student class inherits from Person, and that student and person are objects from the obvious classes. Then, for example, the … Continue reading

Posted in classes, OOP, syntax | Tagged , , , , , , , , , | Leave a comment

Compare a list priority queue to a heap priority queue in C#

My book Essential Algorithms: A Practical Approach to Computer Algorithms describes lots of other interesting data structures and algorithms, many just as interesting but less complicated than this one. For more information about queues, priority queues, trees and other algorithmic … Continue reading

Posted in algorithms, classes, generic, mathematics, OOP | Tagged , , , , , , , , , , , , | 1 Comment

Make an efficient priority queue class in C#, Part 2

My book Essential Algorithms: A Practical Approach to Computer Algorithms describes lots of other interesting data structures and algorithms, many just as interesting but less complicated than this one. For more information about queues, priority queues, trees and other algorithmic … Continue reading

Posted in algorithms, classes, generic, mathematics, OOP | Tagged , , , , , , , , , , , , | Leave a comment

Make an efficient priority queue class in C#, Part 1

For more information about queues, priority queues, trees and other algorithmic topics, see my book Essential Algorithms: A Practical Approach to Computer Algorithms. A priority queue is a data structure that holds data values with associated priorities. The Enqueue method … Continue reading

Posted in algorithms, classes, generic, mathematics, OOP | Tagged , , , , , , , , , , , , | 1 Comment

Map between nodes and node numbers in a binary tree in C#

For more information about trees and other algorithmic topics, see my book Essential Algorithms: A Practical Approach to Computer Algorithms. Suppose you have a binary tree with the nodes numbered as shown on the right. Note that it may have … Continue reading

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

Make animated labels in C#

This example shows how to make animated labels that slowly move into position to make an interesting “movie credit” effect. Note that the example’s result is better than the result giving by the GIF on the right. The GIF is … Continue reading

Posted in animation, graphics, multimedia | Tagged , , , , , , , , , , , , | 1 Comment

Draw animated text in C#

Note that the result in the executable is better than the result giving by the GIF on the right. The GIF is a bit jerky because it uses only 20 frames instead of the 200 used by the program. This … Continue reading

Posted in animation, fonts, graphics, multimedia | Tagged , , , , , , , , , , , | Leave a comment