Public Overloads Function CheckValidImage(ByVal img As Image, ByVal width As Integer, ByVal height As Integer) As Image
If img Is Nothing Then Return Nothing
-
Dim bmp As New Bitmap(width, height)
- Dim tag As Object = img.Tag
- Using g As Graphics = Graphics.FromImage(bmp)
- g.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBicubic
- g.PixelOffsetMode = Drawing2D.PixelOffsetMode.HighQuality
- g.DrawImage(img, 0, 0, width, height)
- End Using
- img.Dispose()
- bmp.Tag = tag
- Return bmp
+ Try
+ Using g As Graphics = Graphics.FromImage(bmp)
+ g.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBicubic
+ g.PixelOffsetMode = Drawing2D.PixelOffsetMode.HighQuality
+ g.DrawImage(img, 0, 0, width, height)
+ End Using
+ bmp.Tag = img.Tag
+ Return bmp
+ Catch ex As Exception
+ bmp.Dispose()
+ bmp = New Bitmap(width, height)
+ bmp.Tag = img.Tag
+ Return bmp
+ Finally
+ img.Dispose()
+ End Try
End Function
End Class
End Sub
Private Sub UnSelectButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UnSelectButton.Click
- HistoryHashList.SelectedIndices.Clear()
+ Do
+ HistoryHashList.SelectedIndices.Clear()
+ Loop While HistoryHashList.SelectedIndices.Count > 0
End Sub
Private Function GetIndexOf(ByVal list As ListBox.ObjectCollection, ByVal value As String) As Integer
If Not Me._isAdd AndAlso Me.HistoryHashList.SelectedIndices.Count > 0 Then
idx = Me.HistoryHashList.SelectedIndices(0)
Me.HistoryHashList.Items.RemoveAt(idx)
- Me.HistoryHashList.SelectedIndices.Clear()
+ Do
+ Me.HistoryHashList.SelectedIndices.Clear()
+ Loop While Me.HistoryHashList.SelectedIndices.Count > 0
Me.HistoryHashList.Items.Insert(idx, hashStr)
Me.HistoryHashList.SelectedIndex = idx
Else
Me.AddHashToHistory(hashStr, False)
- Me.HistoryHashList.SelectedIndices.Clear()
+ Do
+ Me.HistoryHashList.SelectedIndices.Clear()
+ Loop While Me.HistoryHashList.SelectedIndices.Count > 0
Me.HistoryHashList.SelectedIndex = Me.HistoryHashList.Items.IndexOf(hashStr)
End If
Dim callbackImage As Image = Nothing
SyncLock lockObject
If Me.innerDictionary(downloadAsyncInfo.Key) IsNot Nothing Then
- 'callbackImage = New Bitmap(DirectCast(Me.innerDictionary(downloadAsyncInfo.Key), Image))
callbackImage = DirectCast(Me.innerDictionary(downloadAsyncInfo.Key), Image)
End If
End SyncLock
If Me.innerDictionary(downloadAsyncInfo.Key) Is Nothing Then
If dlImage IsNot Nothing Then
Me.innerDictionary.Add(downloadAsyncInfo.Key, dlImage, Me.cachePolicy)
- 'callbackImage = New Bitmap(dlImage)
callbackImage = dlImage
- Else
- Me.innerDictionary.Add(downloadAsyncInfo.Key, New Bitmap(16, 16), Me.cachePolicy)
End If
Else
- 'callbackImage = New Bitmap(DirectCast(Me.innerDictionary(downloadAsyncInfo.Key), Image))
callbackImage = DirectCast(Me.innerDictionary(downloadAsyncInfo.Key), Image)
End If
End SyncLock
For Each key As String In _tabs.Keys
Dim tab As TabClass = _tabs(key)
If tab.Contains(Id) Then
- If tab.Posts.Count = 0 Then
+ If Not tab.IsInnerStorageTabType Then
If tab.UnreadManage AndAlso Not post.IsRead Then '未読管理
SyncLock LockUnread
tab.UnreadCount -= 1
End SyncLock
End If
Else '未読数がずれる可能性があるためtab.Postsの未読も確認する
- Dim tabPost As PostClass = tab.Posts(Id)
- If tab.UnreadManage AndAlso Not tabPost.IsRead Then '未読管理
+ If tab.UnreadManage AndAlso Not tab.Posts(Id).IsRead Then '未読管理
SyncLock LockUnread
tab.UnreadCount -= 1
Me.SetNextUnreadId(Id, tab)
Next
_statuses.Remove(Id)
End If
- For Each tb As TabClass In _tabs.Values
- If tb.IsInnerStorageTabType AndAlso tb.Contains(Id) Then
- post = tb.Posts(Id)
- If tb.UnreadManage AndAlso Not post.IsRead Then
- SyncLock LockUnread
- tb.UnreadCount -= 1
- Me.SetNextUnreadId(Id, tb)
- End SyncLock
- End If
- tb.Remove(Id)
- End If
- Next
End SyncLock
End Sub
End If
Next
If _curTab.Text.Equals(favTabName) Then
- _curList.SelectedIndices.Clear()
+ Do
+ _curList.SelectedIndices.Clear()
+ Loop While _curList.SelectedIndices.Count > 0
If _statuses.Tabs(favTabName).AllCount > 0 Then
If _statuses.Tabs(favTabName).AllCount - 1 > fidx AndAlso fidx > -1 Then
_curList.SelectedIndices.Add(fidx)
For Each tb As TabPage In ListTab.TabPages
DirectCast(tb.Tag, DetailsListView).VirtualListSize = _statuses.Tabs(tb.Text).AllCount
If _curTab.Equals(tb) Then
- _curList.SelectedIndices.Clear()
+ Do
+ _curList.SelectedIndices.Clear()
+ Loop While _curList.SelectedIndices.Count > 0
If _statuses.Tabs(tb.Text).AllCount > 0 Then
If _statuses.Tabs(tb.Text).AllCount - 1 > fidx AndAlso fidx > -1 Then
_curList.SelectedIndices.Add(fidx)
flg = True
End If
- LView.SelectedIndices.Clear()
- 'LView.Items(Index).Selected = True
- LView.SelectedIndices.Add(Index)
+ Do
+ LView.SelectedIndices.Clear()
+ Loop While LView.SelectedIndices.Count > 0
+ LView.Items(Index).Selected = True
+ 'LView.SelectedIndices.Add(Index)
LView.Items(Index).Focused = True
If flg Then LView.Invalidate(bnd)
Dim fIdx As Integer = -1
If Index IsNot Nothing AndAlso Not (Index.Count = 1 AndAlso Index(0) = -1) Then
- LView.SelectedIndices.Clear()
+ Do
+ LView.SelectedIndices.Clear()
+ Loop While LView.SelectedIndices.Count > 0
For Each idx As Integer In Index
If idx > -1 AndAlso LView.VirtualListSize > idx Then
LView.SelectedIndices.Add(idx)