Glossary Item Box
To create one new request of the Knob control is
necessary to use
New constructor while, the used resources
come rileased with the method
Dispose.
Example:
In the following example they
come used two buttons of which the first one, btnCreateKnob, to the activation of the
Click event creates a Knob control, set up
some property and it visualizes it on the form, while according to button,
btnDisposeKnob, to the activation of the
Click event free the resources engaged from the
control.
[Visual Basic]
Dim knb As LabDevTools.Knob Private Sub btnCreateKnob_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCreateKnob.Clickknb =
New LabDevTools.Knobknb.Name = "knbMyKnob"
knb.Appearance.Radius = 37
knb.Top = btnCreateKnob.Top - 165
knb.Left = btnCreateKnob.Left + 10
knb.ForeColor = Color.Red
knb.Appearance.ArcStart = 270
knb.Appearance.ArcEnd = 270
knb.Appearance.CursorProperties.CursorColor = Color.Red
knb.Appearance.Divisions.MayorColor = Color.Violet
knb.Appearance.BorderProperties.BorderWidth = 11
knb.Appearance.BackgroundScale.BackgroundScale =
Trueknb.Appearance.BackgroundScale.BackgroundScaleWidth = 15
knb.Appearance.Divisions.NumberOfDivisions = 20
knb.Appearance.Style = LabDevTools.Appearance.StyleKnob.StyleDial
knb.Values.Max = 1000
knb.Values.Min_Visible =
Falseknb.Values.Min = -1000
Controls.Add(knb)
btnDisposeKnob.Enabled =
True End Sub
Private Sub btnDisposeKnob_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisposeKnob.Click
If Not IsNothing(knb) Then knb.Dispose()btnDisposeKnob.Enabled =
False End Sub
[C#]
LabDevTools.Knob knb;
private void btnCreateKnob_Click(object sender, System.EventArgs e)
{
knb = new LabDevTools.Knob();
knb.Name = "knbMyKnob";
knb.Appearance.Radius = 37;
knb.Top = btnCreateKnob.Top - 165;
knb.Left = btnCreateKnob.Left + 10;
knb.ForeColor = Color.Red;
knb.Appearance.ArcStart=270;
knb.Appearance.ArcEnd=270;
knb.Appearance.CursorProperties.CursorColor = Color.Red;
knb.Appearance.Divisions.MayorColor = Color.Violet;
knb.Appearance.BorderProperties.BorderWidth = 11;
knb.Appearance.BackgroundScale.BackgroundScale = true;
knb.Appearance.BackgroundScale.BackgroundScaleWidth = 15;
knb.Appearance.Divisions.NumberOfDivisions = 20;
knb.Appearance.Style = LabDevTools.Appearance.StyleKnob.StyleDial;
knb.Values.Max = 1000;
knb.Values.Min = -1000;
knb.Values.Min_Visible=false;
Controls.Add(knb);
btnDisposeKnob.Enabled = true;
}
private void btnDisposeKnob_Click(object sender, System.EventArgs e)
{
if(knb!=null){knb.Dispose();}
btnDisposeKnob.Enabled = false;
}
Copyright © 2007 LabDevTools. All Rights Reserved.