Tag Archives: Windows Forms programming

Understand AutoScaleMode in C#

A form’s AutoScaleMode property lets a form automatically resize itself when its font changes. This can be particularly useful with an aging user population that may have trouble seeing smaller fonts. To try to help users out, you can give … Continue reading

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

Draw transformed text in C#

This example uses the following Paint event handler to draw transformed text. // Draw some transformed text. private void Form1_Paint(object sender, PaintEventArgs e) { // Transform. e.Graphics.ScaleTransform(1.5f, 1.5f, MatrixOrder.Append); e.Graphics.RotateTransform(25, MatrixOrder.Append); e.Graphics.TranslateTransform(80, 30, MatrixOrder.Append); // Make a font. using (Font … Continue reading

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

Tip: Make parentheses matching more visible in C#

Recently someone asked me if there was a Visual Studio add-in that highlighted parentheses, brackets, and braces so it would be easier to tell which closing parenthesis matched which opening parenthesis. It turns out that Visual Studio already has a … Continue reading

Posted in coding, miscellany, tips | Tagged , , , , , , , , | 1 Comment

Display tips in a status bar instead of a tooltip in C#

A tooltip provides information when a user needs it but remains unobtrusive when the user doesn’t need the information. For example, normally you can chug through a form filling in fields such as Name, Street, City, and State without any … Continue reading

Posted in controls, tips, user interface | Tagged , , , , , , , , , , , , | 2 Comments

Make a sunburst chart in C#, Part 4

The previous post showed how to make a sunburst chart with curved text. This example extends that one so it can draw multi-line text. The previous post used the DrawTextOnArc method to draw curved text. The text is a distance … Continue reading

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

Make a sunburst chart in C#, Part 3

The post Make a sunburst chart in C#, Part 1 shows how to build a basic sunburst chart. The post Make a sunburst chart in C#, Part 2 enhances that example by drawing each node’s text at an angle so … Continue reading

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

Make a sunburst chart in C#, Part 2

The post Make a sunburst chart in C#, Part 1 explained how to build a simple sunburst chart. Unfortunately the node labels used by that chart didn’t fit their wedges very well because the text was all drawn horizontally. This … Continue reading

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

Make a sunburst chart in C#, Part 1

A sunburst chart displays hierarchical data in a circular diagram. The hierarchy’s root is drawn in the center. Its children sit in a ring around the root. After that, each node’s wedge in a ring is divided among its children … Continue reading

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

Make a status strip label that sticks to the right side of the form in C#

To create a status strip label, add a StatusStrip control to the form. When you select the StatusStrip, it should display an icon with a dropdown arrow. Click the arrow and select the kind of control you want to add … Continue reading

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

Parse file sizes in KB, MB, GB, and so forth in C#

The example Format file sizes in KB, MB, GB, and so forth in C# shows how to convert a number into a string formatted in KB, MB, etc. This example does the opposite: it parses a value such as “1.23 … Continue reading

Posted in algorithms, files, mathematics | Tagged , , , , , , , , , | Leave a comment