diff --git a/GBM/Forms/frmChooseGame.Designer.vb b/GBM/Forms/frmChooseGame.Designer.vb index 0ac5c72..72065c6 100644 --- a/GBM/Forms/frmChooseGame.Designer.vb +++ b/GBM/Forms/frmChooseGame.Designer.vb @@ -24,8 +24,8 @@ Partial Class frmChooseGame Private Sub InitializeComponent() Me.lblChoose = New System.Windows.Forms.Label() Me.btnChoose = New System.Windows.Forms.Button() - Me.lstGameBox = New System.Windows.Forms.ListBox() Me.btnCancel = New System.Windows.Forms.Button() + Me.lstGameBox = New System.Windows.Forms.ListView() Me.SuspendLayout() ' 'lblChoose @@ -39,39 +39,40 @@ Partial Class frmChooseGame ' 'btnChoose ' - Me.btnChoose.Location = New System.Drawing.Point(72, 135) + Me.btnChoose.Location = New System.Drawing.Point(201, 176) Me.btnChoose.Name = "btnChoose" Me.btnChoose.Size = New System.Drawing.Size(90, 23) - Me.btnChoose.TabIndex = 2 + Me.btnChoose.TabIndex = 1 Me.btnChoose.Text = "C&hoose Game" Me.btnChoose.UseVisualStyleBackColor = True ' - 'lstGameBox - ' - Me.lstGameBox.FormattingEnabled = True - Me.lstGameBox.HorizontalScrollbar = True - Me.lstGameBox.Location = New System.Drawing.Point(15, 34) - Me.lstGameBox.Name = "lstGameBox" - Me.lstGameBox.Size = New System.Drawing.Size(228, 95) - Me.lstGameBox.Sorted = True - Me.lstGameBox.TabIndex = 1 - ' 'btnCancel ' - Me.btnCancel.Location = New System.Drawing.Point(168, 135) + Me.btnCancel.Location = New System.Drawing.Point(297, 176) Me.btnCancel.Name = "btnCancel" Me.btnCancel.Size = New System.Drawing.Size(75, 23) - Me.btnCancel.TabIndex = 3 + Me.btnCancel.TabIndex = 2 Me.btnCancel.Text = "&Cancel" Me.btnCancel.UseVisualStyleBackColor = True ' + 'lstGameBox + ' + Me.lstGameBox.FullRowSelect = True + Me.lstGameBox.Location = New System.Drawing.Point(12, 25) + Me.lstGameBox.MultiSelect = False + Me.lstGameBox.Name = "lstGameBox" + Me.lstGameBox.Size = New System.Drawing.Size(360, 145) + Me.lstGameBox.TabIndex = 0 + Me.lstGameBox.UseCompatibleStateImageBehavior = False + Me.lstGameBox.View = System.Windows.Forms.View.Details + ' 'frmChooseGame ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(255, 166) - Me.Controls.Add(Me.btnCancel) + Me.ClientSize = New System.Drawing.Size(384, 211) Me.Controls.Add(Me.lstGameBox) + Me.Controls.Add(Me.btnCancel) Me.Controls.Add(Me.btnChoose) Me.Controls.Add(Me.lblChoose) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle @@ -87,6 +88,6 @@ Partial Class frmChooseGame End Sub Friend WithEvents lblChoose As System.Windows.Forms.Label Friend WithEvents btnChoose As System.Windows.Forms.Button - Friend WithEvents lstGameBox As System.Windows.Forms.ListBox Friend WithEvents btnCancel As Button + Friend WithEvents lstGameBox As ListView End Class diff --git a/GBM/Forms/frmChooseGame.vb b/GBM/Forms/frmChooseGame.vb index a19fac0..95f3795 100644 --- a/GBM/Forms/frmChooseGame.vb +++ b/GBM/Forms/frmChooseGame.vb @@ -25,24 +25,25 @@ Public Class frmChooseGame End Set End Property - Private Sub FillComboBox() + Private Sub FillList() Dim sTags As String - Dim sName As String - lstGameBox.ValueMember = "Key" - lstGameBox.DisplayMember = "Value" + Dim oListViewItem As ListViewItem + + lstGameBox.BeginUpdate() + + lstGameBox.Columns.Add(frmChooseGame_ColumnName, 180) + lstGameBox.Columns.Add(frmChooseGame_ColumnTags, 175) For Each o As clsGame In Process.DuplicateList sTags = mgrGameTags.PrintTagsbyID(o.ID) - If sTags <> String.Empty Then - sName = o.Name & " (" & sTags & ")" - Else - sName = o.Name - End If - lstGameBox.Items.Add(New KeyValuePair(Of String, String)(o.ID, sName)) + oListViewItem = New ListViewItem(New String() {o.Name, sTags}) + oListViewItem.Tag = o.ID + If lstGameBox.Items.Count = 0 Then oListViewItem.Selected = True + lstGameBox.Items.Add(oListViewItem) oGamesHash.Add(o.ID, o) Next - lstGameBox.SelectedIndex = 0 + lstGameBox.EndUpdate() End Sub Private Sub SaveSelection() @@ -51,8 +52,8 @@ Public Class frmChooseGame End Sub Private Sub GetSelection() - Dim oSelected As KeyValuePair(Of String, String) = lstGameBox.SelectedItem - oGame = DirectCast(oGamesHash.Item(oSelected.Key), clsGame) + Dim oSelected As String = lstGameBox.SelectedItems(0).Tag + oGame = DirectCast(oGamesHash.Item(oSelected), clsGame) SaveSelection() bGameSelected = True Me.DialogResult = DialogResult.OK @@ -71,12 +72,14 @@ Public Class frmChooseGame Private Sub frmChooseGame_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load SetForm() - FillComboBox() + FillList() Me.Focus() End Sub Private Sub btnChoose_Click(sender As System.Object, e As System.EventArgs) Handles btnChoose.Click - GetSelection() + If lstGameBox.SelectedItems.Count > 0 Then + GetSelection() + End If End Sub Private Sub frmChooseGame_FormClosing(sender As System.Object, e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing diff --git a/GBM/My Project/Resources.Designer.vb b/GBM/My Project/Resources.Designer.vb index 1821ce0..eff31d5 100644 --- a/GBM/My Project/Resources.Designer.vb +++ b/GBM/My Project/Resources.Designer.vb @@ -888,6 +888,24 @@ Namespace My.Resources End Get End Property + ''' + ''' Looks up a localized string similar to Name. + ''' + Friend ReadOnly Property frmChooseGame_ColumnName() As String + Get + Return ResourceManager.GetString("frmChooseGame_ColumnName", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to Tags. + ''' + Friend ReadOnly Property frmChooseGame_ColumnTags() As String + Get + Return ResourceManager.GetString("frmChooseGame_ColumnTags", resourceCulture) + End Get + End Property + ''' ''' Looks up a localized string similar to Choose Game. ''' diff --git a/GBM/My Project/Resources.resx b/GBM/My Project/Resources.resx index 93ecc85..c42ae26 100644 --- a/GBM/My Project/Resources.resx +++ b/GBM/My Project/Resources.resx @@ -2374,4 +2374,10 @@ Current Folder + + Name + + + Tags + \ No newline at end of file