Author Archives: Rod Stephens

Paste files from the clipboard in C#

It’s a bit harder to paste files from the clipboard than it is to paste text. Copying and pasting text is relatively straightforward. See Copy and paste text to and from the clipboard C#. When you copy files to the … Continue reading

Posted in clipboard, interoperability | Tagged , , , , , , , , , , , , | Leave a comment

Display a horizontal scrollbar in a ListBox in C#

Displaying a horizontal scrollbar is easy but useful. If you need to display some long values in a ListBox, you may want to be able to scroll to the right to see the ends of the values. For example, this … Continue reading

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

How to use the examples at C# Helper

First, read over the text and the code shown on the web page. If you only need a small piece of code, that may be all you need. For example, if you don’t remember how to draw lines with custom … Continue reading

Posted in example program, miscellany | Tagged , , , , , , , | Leave a comment

Draw text on a circle in C#

This example uses some of the techniques described in the post Measure character positions when drawing long strings in C# to draw text on a circle. The previous post explains how to determine where the characters in a string will … Continue reading

Posted in algorithms, fonts, geometry, graphics, strings | Tagged , , , , , , , , , , , , , , , , , , , | Leave a comment

List Dictionary keys and values in C#

A Dictionary object’s Keys property is a KeyCollection containing the dictionary’s keys. Similarly, its Values property is a ValueCollection containing the dictionary’s values. These collections are slightly different from the List objects that you probably use in your code. In … Continue reading

Posted in algorithms, controls, lists | Tagged , , , , , , , , , , , , | Leave a comment

Animate a point on a polar coordinate curve in C#

The example Graph a curve in polar coordinates in C# explained how to draw the flower-like curve on the right. Once you know how to draw such a curve, it’s not too hard to animate points moving along it. The … Continue reading

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

Graph a curve in polar coordinates in C#

In Cartesian coordinates, a point is specified by X and Y values. In polar coordinates, a point is specified by r and θ where: r is the point’s radial distance from the origin θ is the angle that gives the … Continue reading

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

Create a PowerPoint presentation from a Word document in C#

This example shows how you can create a PowerPoint presentation containing slides that correspond to selected styles in a Microsoft Word document. How to Use It Enter or select a Word document and a destination PowerPoint presentation. Enter the styles … Continue reading

Posted in interoperability, Office, Word | Tagged , , , , , , , , , , , , , , , | Leave a comment

Compare floating-point values safely in C#

The computer stores values, including floating-point values, in binary using 0s and 1s. That means it cannot store all possible decimal values exactly. Sometimes when you multiply or divide two floating-point values, the computer is unable to store the result … Continue reading

Posted in calculations, mathematics | Tagged , , , , , , , , , , , , , | 3 Comments

Resize a RichTextBox to fit its contents in C#

This example shows how you can resize a RichTextBox control so it fits the text and images that it contains. The example Resize a TextBox to fit its text in C# shows how to make a TextBox fit its text. … Continue reading

Posted in controls, user interface | Tagged , , , , , , , , , , , | 5 Comments