ListView控件显示 图片加文字说明 并且可以对滚动条进行控制

using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace ListViewNav
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

            ShowBorder(listView1.Handle, false);
            ShowBorder(listView2.Handle, false);
            ShowBorder(listView3.Handle, false);
        }

        const int GWL_STYLE = -16;
        const int WS_BORDER = 0x00800000;
        const int SWP_NOSIZE = 0x1;
        const int SWP_NOMOVE = 0x2;
        const int SWP_FRAMECHANGED = 0x20;

        [DllImport("coredll.dll")]
        private static extern int GetWindowLong(IntPtr hWnd, int nIndex);

        [DllImport("coredll.dll")]
        private extern static void SetWindowLong(IntPtr hwnd, int nIndex, int dwNewLong);

        [DllImport("coredll.dll")]
        private static extern bool SetWindowPos(IntPtr hwnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, int uflags);

        private void ShowBorder(IntPtr handle, bool bShow)
        {
            int style = GetWindowLong(handle, GWL_STYLE);
            if (bShow)
            {
                style |= WS_BORDER;
            }
            else
            {
                style &= ~WS_BORDER;
            }
            SetWindowLong(handle, GWL_STYLE, style);
            SetWindowPos(handle, IntPtr.Zero, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
        }

    }
}

 

 

posted on 2011-12-01 15:54 钻石眼泪 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/huanghai223/archive/2011/12/01/2270726.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值