Tag Archives: controls

Yield checked TreeView nodes in C#

The previous example used recursion to traverse the nodes in a TreeView control and fill a list with the nodes that are checked. This example uses a slightly different approach. It traverses the TreeView control’s nodes and uses the yield … Continue reading

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

Make a list of checked TreeView nodes in C#

If you set a TreeView control’s CheckBoxes property to true, then the control displays boxes that the user can check to select nodes. In that case you will probably need to find the checked TreeView nodes at some point. Strangely … Continue reading

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

Display tooltips for TreeView nodes in C#

At design time, I added a TreeView control to the form. I also added an associated ImageList control to hold images for the TreeView control’s nodes, and I set the TreeView control’s ImageList property to the ImageList control. Finally I … Continue reading

Posted in controls, user interface | Tagged , , , , , , , , , , , , , | Leave a 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 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

Highlight the DataGridView row that is under the mouse in C#

Someone recently asked me how to change the style of the row under the mouse in a DataGridView control. This example does that. When the program starts, the following code prepares the DataGridView for use. // The style to use … Continue reading

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

Display a form’s control hierarchy in C#

This example displays the control hierarchy for a form. It’s actually relatively simple. Some controls can contain other controls. For example, a form is a control and it contains all of a Windows Forms application’s controls. Similarly Panel, TableLayoutPanel, SplitContainer, … Continue reading

Posted in controls, forms | Tagged , , , , , , , , , , , , | Leave a comment

Loop over a form’s controls in C#

This example shows how to loop over controls of various types on a form. The Control class defines a Controls property that is a collection containing references to the controls inside a control. For example, a form’s Controls collection holds … Continue reading

Posted in controls, forms | Tagged , , , , , , , , , , , , | 2 Comments

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

Remove a TextBox control’s context menu in C#

Normally a TextBox control has a context menu that appears when you right-click it, but what if you don’t want that context menu? I mean, really. Am I required to have “Show Unicode control characters” and “Open IME” on every … Continue reading

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