Monthly Archives: March 2018

Display icons next to ListView sub-items in C#

This example displays icons next to ListView sub-items when the ListView is in Detail View. This requires two steps beyond what is required to make a ListView display item icons: (1) assigning image indices to the sub-items, and (2) making … Continue reading

Posted in controls | Tagged , , , , , , , , , , , , , , , | 3 Comments

Display large and small ListView icons in C#

You can display two sizes of ListView icons. When the control’s View property is LargeIcon or Tile, the control displays large icons. When the View property is SmallIcon, List, or Details, the control displays small icons. The control gets its … Continue reading

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

Get assembly information in C#

To set a project’s assembly information, open the Project menu, select Properties, click the Application tab, and click the Assembly Information button. When you do, you’ll see the Assembly Information dialog shown on the right. Here you can set various … Continue reading

Posted in settings, system | Tagged , , , , , , , , , , , , , , , , , , | 4 Comments

Use a custom dash pattern with WPF and XAML in C#

My post Render dashed lines in a WPF program using C# explains how a WPF program can use C# code to render lines with a custom dash pattern onto a bitmap. This post shows how to use a custom dash … Continue reading

Posted in drawing, geometry, graphics, wpf, XAML | Tagged , , , , , , , , , , , , , , , , , , , , , | Comments Off on Use a custom dash pattern with WPF and XAML in C#

Use StringFormat to align text in columns in C#

My previous post Use tabs and StringFormat to align text in C# showed how to use a StringFormat object to draw tab-delimited text in columns. Unfortunately, that method doesn’t give you control over how the values in each column are … Continue reading

Posted in fonts, graphics, strings | Tagged , , , , , , , , , , , , , | 2 Comments

Use tabs and StringFormat to align text in C#

This example shows how you can use a StringFormat object to align tab-delimited text when drawing it on a window. The Graphics class’s DrawString method draws a string on a window, PictureBox, Bitmap, or other drawing surface. The DrawString method … Continue reading

Posted in fonts, graphics, strings | Tagged , , , , , , , , , , , , , | 1 Comment

Make a skinned form in C#, Part 2 (the code)

My previous post explained the controls that this example uses to let you give a form a skin. Basically an arrangement of Panel and PictureBox controls with the Dock properties set appropriately draw the form’s edge and corner images. If … Continue reading

Posted in user interface | Tagged , , , , , , , , | Comments Off on Make a skinned form in C#, Part 2 (the code)

Make a skinned form in C#, Part 1 (the controls)

A skinned form is just plain cool. It adds a bit of interest to the square windows used by every other application. By setting a Windows Form’s TransparencyKey property to a color that should not be rendered, you can make … Continue reading

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

Use VBA to randomize cells in Excel

This is quick excursion into Excel VBA programming. This example uses a VBA macro to let you randomize the selected cells in an Excel workbook. If you select a contiguous block of cells and click the Randomize button, the following … Continue reading

Posted in Excel, Office, VBA | Tagged , , , , , , , , , , , , , | 4 Comments

Make a PictureBox act like a button in C#

This program uses several images to make a PictureBox behave like a button. These images give you complete control over how the “button” looks as it is pressed and released. A button should have these behaviors: When the mouse is … Continue reading

Posted in controls, user interface | Tagged , , , , , , , , , | Comments Off on Make a PictureBox act like a button in C#