Monthly Archives: July 2015

Display images in an Access database in WPF and C#

This example shows how you can display images stored in an Access database in a WPF program. You can do this with bound controls, but I find this approach less confusing because you do everything explicitly in code. When the … Continue reading

Posted in database, graphics, image processing, Office | Tagged , , , , , , , , , , | Leave a comment

Load an image at runtime in WPF and C#

This example shows how to load an image at runtime in a WPF program. As is often the case with WPF, it’s easy once you know what to do. It’s figuring out what to do that’s hard. In short, you … Continue reading

Posted in graphics, image processing, wpf | Tagged , , , , , , , , , , , , , , | Leave a comment

Add ComboBox choices at runtime in C#

This example lets you add ComboBox choices when the user selects them at runtime. To keep track of the choices for future use, it saves them in the Registry. The example Easily save and restore a form’s settings in the … Continue reading

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

Continuously graph stock prices in C#

The example Get stock prices from the internet in C# explains how to get stock prices from the Yahoo! finance web site. This example uses similar techniques to query the site periodically and then graph stock prices. This example is … Continue reading

Posted in algorithms, finance, graphics, internet, mathematics, multimedia, web | Tagged , , , , , , , , , , , , , , | Leave a comment

Move a form without a title bar in C#

When the user presses the mouse down over the green lblMoveForm Label in the form’s upper right corner, the following event handler executes. // On left button, let the user drag the form. private void lblMoveForm_MouseDown(object sender, MouseEventArgs e) { … Continue reading

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

Use image subtraction to compare images in C#

The following examples shows two approaches for seeing how much two images differ. Compare images to find differences in C# Compare images to find subtle differences in C# The first example only works well with drawn images, not photographs, because … Continue reading

Posted in graphics, image processing | Tagged , , , , , , , , , , , , | Leave a comment

Compare images to find subtle differences in C#

The example Compare images to find differences in C# lets you compare images pixel-by-pixel. Unfortunately it regards the pixels in the images different if they are not exactly the same. That’s fine if the images are full of lines and … Continue reading

Posted in graphics, image processing | Tagged , , , , , , , , , , , | Leave a comment

Compare images to find differences in C#

This example lets you compare images to see if they are the same. When you select two images to compare and click the Go button, the program executes the following code to compare the images and see at which pixels … Continue reading

Posted in graphics, image processing | Tagged , , , , , , , , , | 11 Comments

Use a loop to load pictures in C#

When the form loads, the following code loads pictures into the form’s PictureBoxes. private void Form1_Load(object sender, EventArgs e) { string dirname = Path.GetFullPath( Path.Combine(Application.StartupPath, @”..\..\”)); // Make an array holding the PictureBoxes. PictureBox[] pics = { PictureBox1, PictureBox2, PictureBox3, … Continue reading

Posted in graphics, image processing | Tagged , , , , , , , , , | Leave a comment

Make a kaleidoscope program in C#

When you click and draw on this program’s form, the code draws other curves related to yours to produce a kaleidoscope effect. For example, it might draw a mirror image of what you draw or it might repeat your drawing … Continue reading

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