Tag Archives: graphics

Make a shaded ellipse control in C#

Note: Before you can use the ShadedEllipse control in the example program, you must build the solution. After you download the example, build it before you try to view the form. This example walks through building a control that draws … Continue reading

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

Use digits of Pi to draw a picture in C#

The article 10 stunning images show the beauty hidden in pi shows several ways to use Pi to generate pictures. This example demonstrates one of them. The program starts drawing at the origin (0, 0). It then scans through the … Continue reading

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

Make the basis for a card game in C#

The goal of this example is to provide some support for building a card game. It shows how to make a class to represent cards and to to tell what card is displayed in a PictureBox. It’s actually relatively straightforward. … Continue reading

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

Verify sizes of playing cards in C#

Recently I wanted to use some playing cards in a program so I looked online for some nice images. I could have included 55 or so separate images (including jokers and backs), but I decided it would be easier to … Continue reading

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

Draw, move, and delete line segments in VB.NET

This progra lets you draw, move, and delete line segments from a drawing. It’s a Visual Basic .NET version of the example Draw, move, and delete line segments in C# made by request. Click and drag to draw line segments. … Continue reading

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

Convert a Rectangle into a RectangleF and vice versa in C#

The RectangleF structure has an overloaded assignment operator = that lets you simply set a RectangleF equal to a Rectangle, so converting a Rectangle into a RectangleF is easy. That makes sense because converting from Rectangle to RectangleF is a … Continue reading

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

Make a hangman game in C#

Special thanks to Jeff Scarterfield for the skeleton drawing used by the program. This example builds a simple hangman game that uses the dictionary created by the example Use LINQ to select words of certain lengths from a file in … Continue reading

Posted in algorithms, files, games, graphics, strings | Tagged , , , , , , , , , , , , | Leave a comment

Draw a golden spiral in C#

This example shows how to draw a golden spiral (or phi spiral) in C#. The example Draw a nested series of golden rectangles in C# draws nested rectangles and connects their corners to make a square “spiral.” This example makes … Continue reading

Posted in algorithms, drawing, graphics, mathematics | Tagged , , , , , , , , , , , , , , | 3 Comments

Draw a nested series of golden rectangles in C#

This program draws golden rectangles, rectangles whose side ratio is equal to φ. For information on φ, see Examine the relationship between the Fibonacci sequence and phi in C#. The program first draws a golden rectangle. It then removes the … Continue reading

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

Examine the relationship between the Fibonacci sequence and phi in C#

The golden ratio (also called the golden mean, golden section, or divine proportion) is a number that pops up in a surprising number of places in geometry and nature. This number is also called φ (phi, pronounced either “fee” or … Continue reading

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