Monthly Archives: September 2015

Draw a histogram with tooltips in C#

The example Draw a simple histogram in C# explains how to draw a simple histogram. When you click on a bar, that program displays a message box showing the bar’s value. This example takes a different approach. When you move … Continue reading

Posted in drawing, graphics, mathematics | Tagged , , , , , , , , , , | Comments Off on Draw a histogram with tooltips in C#

Draw a simple histogram in C#

When the program loads, the following code generates some random data. private const int MIN_VALUE = 0; private const int MAX_VALUE = 100; private float[] DataValues = new float[10]; // Make some random data. private void Form1_Load(object sender, EventArgs e) … Continue reading

Posted in drawing, graphics, mathematics | Tagged , , , , , , , , | 9 Comments

Help with a new book

Some time in the next few weeks, I plan to launch a Kickstarter campaign to help fund a new graphics book. It’s an enormous topic so I could probably write a few thousand pages on the topic, but that would … Continue reading

Posted in books, drawing, graphics, image processing, Uncategorized | Tagged , , , | 3 Comments

Use a ColorMatrix to add a watermark to an image in C#

The example Add a watermark to an image in C# explains how to add a translucent watermark to an image. This example does the same thing in a slightly different and probably more efficient way. The example uses the following … Continue reading

Posted in graphics, image processing | Tagged , , , , , , , , , | 1 Comment

Add a watermark to an image in C#

The following DrawWatermark method copies a watermark image onto an image. // Copy the watermark image over the result image. private void DrawWatermark(Bitmap watermark_bm, Bitmap result_bm, int x, int y) { const byte ALPHA = 128; // Set the watermark’s … Continue reading

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

Use global command bindings in WPF and C#

The example Use custom command bindings in WPF and C# explains how you can make a program use custom commands. (This is a confusing topic so read that post before you continue with this one.) That technique doesn’t quite work … Continue reading

Posted in events, user interface | Tagged , , , , , , , , , , , , , | Comments Off on Use global command bindings in WPF and C#

Use custom command bindings in WPF and C#

The example Use pre-defined command bindings in WPF and C# explains how you can make a program use pre-defined commands. (This is a confusing topic so read that post before you continue with this one.) This example shows how you … Continue reading

Posted in events, user interface | Tagged , , , , , , , , , , , , , | 2 Comments

Use pre-defined command bindings in WPF and C#

Command bindings provide yet another demonstration of the unofficial WPF slogan: twice as flexible and only 10 times as hard. The idea is a good one: Connect all of the program’s methods for invoking a command to a single point … Continue reading

Posted in events, user interface | Tagged , , , , , , , , , , , , | 1 Comment

Make a selection dialog that uses a color wheel in C#

The example Draw a color wheel with alpha and saturation values in C# lets the user select a color on a color wheel. This example uses that technique to build a color selection dialog. This change is fairly easy. First … Continue reading

Posted in drawing, graphics, image processing | Tagged , , , , , , , , , , , , , , , , , | Comments Off on Make a selection dialog that uses a color wheel in C#

Draw a color wheel with alpha and saturation values in C#

The example Draw a colorful color wheel in C# shows how to draw a color wheel. This example lets you use scroll bars to change the alpha (opaqueness) and saturation (grayness) values of the colors. This is actually a pretty … Continue reading

Posted in drawing, graphics, image processing | Tagged , , , , , , , , , , , , , , | 1 Comment