Category Archives: animation

Animate rainbow colors in C#

The example Map numeric values to and from colors in a color gradient in C# draws a color gradient that uses rainbow colors. This example animates that one. When you click on the color gradient, the following code starts or … Continue reading

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

Animate exploding 3-dimensional pie slices in C#

The example Draw 3-dimensional pie slices in C# shows how to highlight one or more 3-D pie slices by “exploding” them. This example draws even more attention to the exploded pie slices by animating their explosion. The program controls the … Continue reading

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

Use Windows Forms controls to make multiple stacked expanders in C#

The example Use Windows Forms controls to make an expander in C# shows how to make simple expanders. By collapsing a Panel, the program allows the user to hide unwanted information. That frees up space on the form that the … Continue reading

Posted in animation, controls, multimedia | Tagged , , , , , , , , , , , , , | 5 Comments

Use Windows Forms controls to make an expander in C#

WPF, Silverlight, Metro, or whatever Microsoft is calling this stuff now days has some useful controls in the System.Windows.Controls namespace including Expander. An Expander displays a small arrow button and a panel where you can place other controls. When the … Continue reading

Posted in animation, controls, multimedia | Tagged , , , , , , , , , , | Leave a comment

Draw “marching ants” dashed lines in C#

The example Draw dashed lines that are visible on any background in C# shows how to draw lines that are visible above any backgrounds. If the background is very cluttered, however, it may still be somewhat hard to see the … Continue reading

Posted in animation, drawing, graphics | Tagged , , , , , , , , , , , , , | 4 Comments

Make a cannon game in C#

This simple cannon game randomly positions a target house. Then when you click the Shoot button, it gets angle and speed information for the cannon and enables a timer. To keep the graphics and timing simple, the program uses a … Continue reading

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

Animate images in C#

This example shows how to animate images by loading them at run time and then playing them one at a time. To make finding the images easier, I added them to the project. (Open the Project menu, select Add Existing … Continue reading

Posted in algorithms, animation, image processing | Tagged , , , , , , , , , , | Leave a comment

Draw gears in C#

This example uses the following DrawGear method to draw gears. // Draw a gear. private void DrawGear(Graphics gr, Brush axle_brush, Brush gear_brush, Pen gear_pen, PointF center, float radius, float tooth_length, int num_teeth, float axle_radius, bool start_with_tooth) { float dtheta = … Continue reading

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

Draw an analog clock in C#

This example demonstrates several useful techniques including: Context menus Restricting a form to a region to give it a shape. Moving a form with no title bar Double buffering Drawing with transformations Drawing an analog clock When you right-click the … Continue reading

Posted in animation, drawing, forms, graphics | Tagged , , , , , , , , , , , , , , , , , | 2 Comments

Animate a piston driving a wheel in C#

This example draws a piston that powers a rotating wheel. The program uses a timer to move the piston. The following code shows the timer’s Tick event handler. // Move the piston. private void tmrMovePiston_Tick(object sender, EventArgs e) { X … Continue reading

Posted in algorithms, animation, drawing, graphics, multimedia | Tagged , , , , , , , , , , , , | Leave a comment