This article describes how a simple Windows Forms control element can be created by means of the SharpShooter Gauges.

Download the Sample Application: GettingStartedWidget.zip

Run Microsoft Visual Studio and create a new project – C# Windows Application.

Put the IndicatorWidget component onto the form.

IndicatorWidget is a visual component intended for displaying an instrument.

It is necessary to assign the instrument that will be displayed in this component. Double click to run the instrument designer. After the designer is launched, the dialog window in which the instrument template can be selected appears.

On the left of the window the instruments templates that can be used are presented. Choose the appropriate instrument template. For example, choose the SimpleGauge instrument from the Gauges group:

Click “OK”, and the selected element will be added to the designer for editing.

The instrument consists of the separate elements, each of which has its own functionality and properties. The designer allows adding, deleting and adjusting their properties. To manipulate the element it is necessary to select it with a mouse in the instrument window or in the tree, displaying the instrument structure.

Exit the designer, pressing the “OK” button for confirming changes. The final instrument will be used by the IndicatorWidget component.

Set indicatorWidget.Dock property to Top and change Form size.

Specify the slider that will be used to receive the Value property to the component. To do it set the “Slider1” value to the SliderName property in the property grid.

Place the Label component onto the form for displaying the current IndicatorWidget value. Write the ValueChanded event handler for the indicatorWidget1.

    private void indicatorWidget1_ValueChanged(object sender, EventArgs e)
    {
       label1.Text = "indicatorWidget1.Value = " 
       + indicatorWidget1.Value.ToString();
    }

Run the application.

Add Feedback