using
System;
using
System.Linq;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Text;
using
System.Windows.Forms;
using
System.Runtime.InteropServices;
namespace
SmartDeviceProject2
{
public
partial
class
Form1 : Form
{
public
Form1()
{
InitializeComponent();
}
private
const
uint
LVM_FIRST = 0x1000;
private
const
uint
LVM_SETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 54;
private
const
uint
LVS_EX_GRIDLINES = 0x00000001;
// private const uint LVS_EX_FULLROWSELECT = 0x20;
[DllImport(
"coredll.dll"
, CharSet = CharSet.Auto)]
public
static
extern
IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam);
public
struct
message
{
// public const uint LVM_FIRST = 0x1000;
// public const uint LVM_SETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 54;
private
const
uint
LVS_EX_FULLROWSELECT = 0x20;
public
const
uint
LVS_EX_GRIDLINES = 0x00000001;
}
private
void
Form1_Load(
object
sender, EventArgs e)
{
unsafe
{
message mess =
new
message();
SendMessage(
this
.listView1.Handle, (
uint
)LVM_SETEXTENDEDLISTVIEWSTYLE, (IntPtr)0, (IntPtr)(&mess));
// SendMessage(this.listView1.Handle, (uint)LVM_SETEXTENDEDLISTVIEWSTYLE, (IntPtr)0, ((IntPtr)LVS_EX_GRIDLINES) );
}
}
}
}
转载网址 : http://bbs.csdn.net/topics/390604512?page=1 感谢资源共享的人