Tag Archives: grid

Draw text wrapped to fit columns in C#

The post Draw aligned columns of data in C# shows one way to draw text in rows and columns. It uses the Graphics class’s MeasureString method to size the columns so they are big enough to display their data without … Continue reading

Posted in fonts, graphics, lists | Tagged , , , , , , , , , , , , , , , , | Leave a comment

Print values in a grid in C#

This example prints a set of values in a grid. The following DrawValueGrid method does all of the printing. It’s long but the pieces are relatively simple. // Draw a grid containing the indicated values. private void DrawValueGrid(Graphics gr, RectangleF … Continue reading

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

Make an owner-drawn ListBox that justifies columns in C#

This example shows how you can use an owner-drawn ListBox to left and right align values in columns. The following examples show different ways to align values in columns. Draw aligned columns of data in C# Format values in a … Continue reading

Posted in controls, fonts, graphics, lists, user interface | Tagged , , , , , , , , , , , , , , , , , , | Leave a comment

Draw aligned columns of data in C#

This example draws a series of rows with aligned columns either left or right justified. The program uses the following code to define the data it will draw and the row and column alignments. // The values. private string[][] Values … Continue reading

Posted in fonts, graphics, lists | Tagged , , , , , , , , , , , , , , , | 6 Comments

Draw a hexagonal grid in C#

The post Draw a triangular grid in C# shows how to draw a triangular grid. This post shows how to make a similar hexagonal grid. Row and column numbering is a bit easier with a hexagonal grid than it is … Continue reading

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

Draw a triangular grid in C#

This example shows how to use a triangular grid. (In case you need to build a Tholian web or something.) Row numbers are defined in the obvious way with the first row having number 0. Column numbers are a little … Continue reading

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

Print a grid of values with alternating row colors in C#

The following code shows how the program prints its grid. The complete code isn’t too complicated but it’s long so here it’s broken into several methods. // Draw the grid. private void pdocGrid_PrintPage(object sender, PrintPageEventArgs e) { // Make some … Continue reading

Posted in graphics, printing | Tagged , , , , , , , , , , | 1 Comment

Draw a 3D surface from a set of data points with an altitude map using WPF and C#

This example uses C# and XAML to draw a 3D surface from a set of data points that’s overlaid with a shaded altitude map. The example Draw a 3D surface overlaid with a shaded altitude map using WPF and C# … Continue reading

Posted in algorithms, geometry, graphics, mathematics, wpf, XAML | Tagged , , , , , , , , , , , , , , , , , , | 30 Comments

Draw a 3D surface overlaid with a shaded altitude map using WPF and C#

This example uses C# and XAML to draw a 3D surface overlaid with a shaded altitude map. The example Draw a 3D surface overlaid with a grid using WPF and C# explains how to overlay an image on a three-dimensional … Continue reading

Posted in algorithms, geometry, graphics, mathematics, wpf, XAML | Tagged , , , , , , , , , , , , , , , , , , | 27 Comments

Draw a 3D surface overlaid with a grid using WPF and C#

This example shows how to use C# code and XAML to draw a 3D surface overlaid with a grid. The example Apply textures to triangles using WPF and C# shows how to apply textures to triangles. This example simply uses … Continue reading

Posted in algorithms, geometry, graphics, mathematics, wpf, XAML | Tagged , , , , , , , , , , , , , , , | 11 Comments