Sounds like a Screen DPI issue. Winforms is a classic "PITA" when it comes to DPI and sizing of controls. In an integrated developement environment we has windows XP developers with 96 dpi screen resolution and Windows Vista Developers on Laptops with 120 dpi and it caused the Windows forms designers to get rearranged constantly. In the end we determined that all controls must use a multiple of 4 when setting size/location on a screen to minimise the issue.
To a lesser extent WPF addresses this issue and Vista/Windows7/XP application look basically the same on when different DPI's are used. But WindowsForms to WPF is not a straight forward technology change. I'm not sure you can get at the ListViewItem size easily in a Windows Forms application.
When I look at my screen printing code for Windows Forms it uses the Size method to get dimensions before I render it to a bitmap. Maybe that might work.
Public Class PrintScreen
' Code that explicity finds the outter rectangle size of the current form and then
' takes a screen print of that image.
Shared Sub CurrentForm(ByRef myForm As Windows.Forms.Form)
Dim memoryImage As Bitmap
Dim myGraphics As Graphics = myForm.CreateGraphics()
Dim s As Size = myForm.Size
memoryImage = New Bitmap(s.Width, s.Height, myGraphics)
Dim memoryGraphics As Graphics = Graphics.FromImage(memoryImage)
memoryGraphics.CopyFromScreen(myForm.Location.X, myForm.Location.Y, 0, 0, s)
memoryGraphics.DrawImage(memoryImage, 0, 0)
SaveImage(memoryImage, myForm)
End Sub
' Method to save the screen to a file in the \My Pictures\AppName\ folder
Private Shared Sub SaveImage(ByVal b As Bitmap, ByVal form As Windows.Forms.Form)
Dim AppPictureFolder As String
Dim fileName As String
' Create a file with the forms title + datetime stamp.
fileName = String.Format("{0} {1}.png", form.Text, Date.Now.ToString("yyyyMMdd HHmmss"))
AppPictureFolder = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures), [Assembly].GetExecutingAssembly.GetName.Name)
If Not System.IO.Directory.Exists(AppPictureFolder) Then
System.IO.Directory.CreateDirectory(AppPictureFolder)
End If
b.Save(System.IO.Path.Combine(AppPictureFolder, fileName))
System.Diagnostics.Process.Start(System.IO.Path.Combine(AppPictureFolder, fileName))
End Sub
End Class
In WPF ListViewItem contains much more detailed information you could use. E.g.
System.Windows.Controls.ListView.ListViewItem.ActualHeight See [MSDN][1]
Also I think WPF would also give you some fairly flexible layout options for Lists. I regularly insert WPF controls, containing complex lists designs, into my WindowsForms application to get better layout control. But like I said, WPF is a different kettle of fish.
[1]: http://msdn.microsoft.com/query/dev10.query?appId=Dev10IDEF1&l=EN-US&k=k%28SYSTEM.WINDOWS.FRAMEWORKELEMENT.ACTUALHEIGHTPROPERTY%29;k%28TargetFrameworkMoniker-%22.NETFRAMEWORK%2cVERSION%3dV3.5%22%29;k%28DevLang-VB%29&rd=true "MSDN