Public Class SettingComboBox
	Inherits System.Windows.Forms.ComboBox
	Implements ISettingCtrl

#Region " Windows Form Designer Code "

	Public Sub New()
		MyBase.New()

		InitializeComponent()


	End Sub

	Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
		If disposing Then
			If Not (components Is Nothing) Then
				components.Dispose()
			End If
		End If
		MyBase.Dispose(disposing)
	End Sub

	Private components As System.ComponentModel.IContainer

	<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
		components = New System.ComponentModel.Container
	End Sub

#End Region

	Public Event SettingValueChanged(ByVal sender As Object, ByVal e As EventArgs) Implements ISettingCtrl.SettingValueChanged

	Private m_SettingID As SettingIDs = SettingIDs.UNKNOWN
	Public Property SettingID() As SettingIDs Implements ISettingCtrl.SettingID
		Get
			Return (m_SettingID)
		End Get
		Set(ByVal Value As SettingIDs)
			m_SettingID = Value
		End Set
	End Property
	Public Property SettingValue() As Integer Implements ISettingCtrl.SettingValue
		Get
			If SelectedIndex < 0 Then
				Return (0)
			Else
				Dim ifc As CItemForComboBox = CType(Items(SelectedIndex), CItemForComboBox)
				Return (ifc.SettingValue)
			End If

		End Get
		Set(ByVal Value As Integer)
			For index As Integer = 0 To Items.Count() - 1
				Dim ifc As CItemForComboBox = CType(Items(index), CItemForComboBox)
				If ifc.SettingValue = Value Then
					SelectedIndex = index
					Exit For
				End If
			Next
		End Set
	End Property



	Protected Overrides Sub OnSelectionChangeCommitted(ByVal e As System.EventArgs)
		RaiseEvent SettingValueChanged(Me, New EventArgs)
	End Sub
End Class
