Visual Basic Foro
Programación => Visual Basic .NET / C# => Mensaje iniciado por: E N T E R en Agosto 01, 2012, 12:26:26 pm
-
Hola compañeros, Es posible ajustar el espacio entre iconos en vb.NET.
Como ven en la imagen están muy separadas.
(http://www.mediafire.com/conv/07c6c9d38989714d924fb482315be115adc8cb3aaf758e62bd40e715b6f244104g.jpg)
http://www.mediafire.com/view/?6wkeig8waeyjb1j (http://www.mediafire.com/view/?6wkeig8waeyjb1j)
En VB6 se podía hacer con esta función: http://leandroascierto.com/foro/index.php?topic=1756.msg9838#msg9838 (http://leandroascierto.com/foro/index.php?topic=1756.msg9838#msg9838)
-
Solucionado, aca dejo por si a alguien le sirve.
Imports System.Runtime.InteropServices
Public Class Form2
<DllImport("user32.dll", CharSet:=CharSet.Auto, SetLastError:=False)>
Private Shared Function SendMessage(ByVal hwnd As IntPtr, ByVal wMsg As Int32, ByVal wParam As Int32, ByVal lParam As Int32) As Int32
End Function
Public Sub SetSpacing(ByVal x As Int16, ByVal y As Int16)
SendMessage(ListView1.Handle, LVM_SETICONSPACING, 0, x * 65536 + y)
ListView1.Refresh()
End Sub
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
For i = 0 To 10
Dim item As New ListViewItem(("id").ToString)
item.SubItems.Add(("nombre").ToString)
item.ImageIndex = i
ListView1.Items.Add(item)
Next
SetSpacing(90, 60)
End Sub
End Class