Tag Archives: owner draw

Add tabs to a WPF TabControl at runtime in C#

When you click the + button, this example uses the following code to add a tab to the WPF TabControl named tabMain. // Add a tab to the TabControl. private void btnAdd_Click(object sender, RoutedEventArgs e) { TabItem tab_item = new … Continue reading

Posted in controls | Tagged , , , , , , , , , , , , , | 1 Comment

Make a ComboBox display images with text in C#

The example Make a ComboBox display colors or images in C# shows how to make an owner-drawn ComboBox that displays either a series of color samples or a list of images. This example shows how to make a ComboBox that … Continue reading

Posted in controls, extension methods, graphics | Tagged , , , , , , , , , , , , | 11 Comments

Make a ComboBox display colors or images in C#

There are two kinds of owner-drawn ComboBox controls. In the first kind, every item has the same size. In the second kind of ComboBox, each item can have a different size. Same Sized Items To make all items have the … Continue reading

Posted in controls, extension methods, graphics | Tagged , , , , , , , , , , , , | 6 Comments

Add tabs to a TabControl at runtime in C#

The post Make an improved owner-drawn TabControl in C# shows how to build an owner-drawn TabControl that lets the user remove tabs at runtime. This example lets you add tabs, too. The program includes a Label that displays an X. … Continue reading

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

Make an improved owner-drawn TabControl in C#

The post Make an owner-drawn TabControl in C# shows how to make an owner-drawn tab control. Unfortunately the control behaves strangely if it’s not wide enough to display all of its tabs at once. If the control is too small … Continue reading

Posted in controls | Tagged , , , , , , , , , | 1 Comment

Make an owner-drawn ListBox with pictures in C#

This example extends the previous one Make an owner-drawn ListBox in C# to make an owner-drawn ListBox with pictures. The program uses the following Planet class to represent information about the planets. class Planet { public string Name = “”; … Continue reading

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

Make an owner-drawn TabControl in C#

This example shows a couple of techniques including how to make an owner-drawn TabControl and how to let the user close tabs at run time. The program uses the following Load event handler to get the TabControl ready for use. … Continue reading

Posted in controls | Tagged , , , , , , , , , | 1 Comment