I am trying to add a TrackBar in my ToolStrip. I have found this code somewhere on the net but I am not sure how to use it as it should be compiled maybe?
Code
/// <summary>
/// Adds trackbar to toolstrip stuff
/// </summary>
[
ToolStripItemDesignerAvailability
(ToolStripItemDesignerAvailability.ToolStrip | ToolStripItemDesignerAvailability.StatusStrip)
]
public class ToolStripTraceBarItem : ToolStripControlHost
{
public ToolStripTraceBarItem(): base(new TrackBar())
{
}
}
Any tips will be appriciated!
You can simply copy this code in your form source file. (You also need to import some extra stuff, using System.Windows.Forms.Design;
).
Then you'll be able to see TraceBarItem
in the designer when you try to add an element to your toolstrip.
To customize your TraceBar, add this to the constructor of the class you posted:
TrackBar tb = (TrackBar)this.Control;
You can set all the trackbar's properties using that tb
object.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With