Creating a User Control: .NET Toggle Control


Introduction

This is a C# User Control which re-creates the toggle used by XML, HTML, etc. files in the .NET Developer Studio.  Just compile the control and drag it onto a form from the Windows Form Toolbox. Once the control is added to the form, configure the buttons of the control.

Source Code:

private NETToggle.toggleSelector toggleSelector1;
toggleSelector1.toggleOneText = "Box 1";
toggleSelector1.toggleTwoText = "Box 2";
//assign all the controls to the toggle Selector
private NETToggle.toggleSelector toggleSelector1;
toggleSelector1.toggleOneText = "Box 1";
toggleSelector1.toggleTwoText = "Box 2";
//assign all the controls to the toggle Selector
toggleSelector1.toggleSelectorContainer = panel1;
toggleSelector1.button1Control = richTextBox1;
toggleSelector1.button2Control = richTextBox2;
private NETToggle.toggleSelector toggleSelector1;
toggleSelector1.toggleOneText = "Box 1";
toggleSelector1.toggleTwoText = "Box 2";
//assign all the controls to the toggle Selector
toggleSelector1.toggleSelectorContainer = panel1;
toggleSelector1.button1Control = richTextBox1;
toggleSelector1.button2Control = richTextBox2;


Similar Articles