I have written a Type Converter for a TrackBar. I was wondering if there is any way to get the value being changed in the Dropdown so I can update the PropertyGrid item value dynamically instead of just at the end?
Here is the Type Converter code:
Here is the Property Code:Code:Imports System.Windows.Forms.Design Public Class Slider Private editorService As IWindowsFormsEditorService Private m_Value As Integer Public Property Value() As Integer Get Return m_Value End Get Set(ByVal value As Integer) m_Value = value End Set End Property Public Sub New() ' This call is required by the Windows Form Designer. InitializeComponent() ' Add any initialization after the InitializeComponent() call. tbSlider.LargeChange = 25 tbSlider.SmallChange = 10 tbSlider.TickFrequency = 15 tbSlider.Maximum = 255 tbSlider.Minimum = 0 tbSlider.Size = Me.Size Me.editorService = editorService End Sub Public Sub New(ByVal MyValue As Integer, ByVal MyLargeChange As Integer, ByVal MySmallChange As Integer, ByVal MyTickFrequency As Integer, ByVal MyMinimum As Integer, ByVal MyMaximum As Integer, ByVal editorService As IWindowsFormsEditorService) ' This call is required by the Windows Form Designer. InitializeComponent() ' Add any initialization after the InitializeComponent() call. tbSlider.LargeChange = MyLargeChange tbSlider.SmallChange = MySmallChange tbSlider.TickFrequency = MyTickFrequency tbSlider.Maximum = MyMaximum tbSlider.Minimum = MyMinimum tbSlider.Value = MyValue Me.editorService = editorService End Sub Private Sub tbSlider_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles tbSlider.ValueChanged m_Value = CInt(tbSlider.Value) End Sub End Class
Code:<System.ComponentModel.Category("Appearance"), _ System.ComponentModel.DefaultValue("200"), _ System.ComponentModel.Editor(GetType(OpacitySliderEditor), GetType(System.Drawing.Design.UITypeEditor)), _ System.ComponentModel.Description("Value that represents a change in the Opacity or transparency of the control.")> _ Public Property Opacity() As Integer Get Return m_Opacity End Get Set(ByVal value As Integer) m_Opacity = value SetBkImage() Me.Invalidate() End Set End Property




Reply With Quote