Autor Tema: Ajustar espacio entre iconos en un ListView  (Leído 3578 veces)

0 Usuarios y 1 Visitante están viendo este tema.

E N T E R

  • Petabyte
  • ******
  • Mensajes: 1062
  • Reputación: +57/-13
  • www.enterpy.com
    • Ver Perfil
    • www.enterpy.com
Ajustar espacio entre iconos en un ListView
« 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/view/?6wkeig8waeyjb1j

En VB6 se podía hacer con esta función: http://leandroascierto.com/foro/index.php?topic=1756.msg9838#msg9838
CIBER GOOGLE - CONCEPCIÓN PARAGUAY
www.enterpy.com
Primera regla de la programacion, para que vas a hacerlo complicado si lo puedes hacer sencillo

E N T E R

  • Petabyte
  • ******
  • Mensajes: 1062
  • Reputación: +57/-13
  • www.enterpy.com
    • Ver Perfil
    • www.enterpy.com
Re:Ajustar espacio entre iconos en un ListView
« Respuesta #1 en: Agosto 01, 2012, 01:10:22 pm »
Solucionado, aca dejo por si a alguien le sirve.

Código: (VB) [Seleccionar]
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
CIBER GOOGLE - CONCEPCIÓN PARAGUAY
www.enterpy.com
Primera regla de la programacion, para que vas a hacerlo complicado si lo puedes hacer sencillo