OSDN Git Service

アイコンの描画位置が標準と異なっていたのを修正
authoranis774 <anis774@users.sourceforge.jp>
Sat, 11 Sep 2010 22:24:27 +0000 (22:24 +0000)
committerKimura Youichi <kim.upsilon@bucyou.net>
Sat, 18 Feb 2012 14:15:23 +0000 (23:15 +0900)
git-svn-id: http://svn.sourceforge.jp/svnroot/tween/trunk@849 e39ad16e-3079-482e-bb30-4b4d378143b6

Tween/Tween.vb

index b2242e6..a114106 100644 (file)
@@ -3836,20 +3836,24 @@ Public Class TweenMain
     End Sub
 
     Private Sub DrawListViewItemIcon(ByVal e As DrawListViewSubItemEventArgs)
-        'e.Bounds.Leftが常に0を指すから自前で計算
-        Dim x As Integer = e.Item.ListView.GetItemRect(e.ItemIndex).X
-
-        For Each clm As ColumnHeader In e.Item.ListView.Columns
-            If clm.DisplayIndex < e.Item.ListView.Columns(0).DisplayIndex Then
-                x += clm.Width
-            End If
-        Next
-
         Dim item As ImageListViewItem = DirectCast(e.Item, ImageListViewItem)
 
         If item.Image IsNot Nothing Then
-            e.Graphics.InterpolationMode = Drawing2D.InterpolationMode.High
-            e.Graphics.DrawImage(item.Image, New Rectangle(x, e.Bounds.Top, Math.Min(_iconSz, e.Item.ListView.Columns(0).Width), _iconSz))
+            'e.Bounds.Leftが常に0を指すから自前で計算
+            Dim itemRect As Rectangle = item.Bounds
+            itemRect.Width = e.Item.ListView.Columns(0).Width
+
+            For Each clm As ColumnHeader In e.Item.ListView.Columns
+                If clm.DisplayIndex < e.Item.ListView.Columns(0).DisplayIndex Then
+                    itemRect.X += clm.Width
+                End If
+            Next
+
+            Dim iconRect As Rectangle = Rectangle.Intersect(item.GetBounds(ItemBoundsPortion.Icon), itemRect)
+            If iconRect.Width > 0 Then
+                e.Graphics.InterpolationMode = Drawing2D.InterpolationMode.High
+                e.Graphics.DrawImage(item.Image, iconRect)
+            End If
         End If
     End Sub