Current location: Hot Scripts Forums » Programming Languages » Windows .NET Programming » [2008] Type Converter Question


[2008] Type Converter Question

Reply
  #1 (permalink)  
Old 09-25-09, 06:15 PM
tim8w tim8w is offline
Wannabe Coder
 
Join Date: Nov 2004
Posts: 183
Thanks: 0
Thanked 0 Times in 0 Posts
[2008] Type Converter Question

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:

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
Here is the Property Code:


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
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Quick question - data type problem DimensionX PHP 1 06-06-09 02:18 AM
[SOLVED] [2008] API Declaration Question tim8w Windows .NET Programming 1 03-03-09 02:52 PM
[SOLVED] [2008] Special Folders Question (My Network Places, Recycle Bin) tim8w Windows .NET Programming 2 03-03-09 10:28 AM
I most definately suggest DevelopingCentral.com For Any Website Design/Development! Salty777 General Advertisements 2 10-01-04 04:27 AM


All times are GMT -5. The time now is 02:17 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.