1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.Windows.Forms;
- using System.IO;
- using System.Drawing;
- using System.Drawing.Drawing2D;
- using System.ComponentModel;
- using System.Data;
- namespace LYFZ.ComponentLibrary
- {
- public class ListViewEx : System.Windows.Forms.ListView
- {
- public ListViewEx()
- {
- }
- private bool _isDefaultShowGroups;
- /// <summary>
- /// 默认是否显示分组
- /// </summary>
- public bool IsDefaultShowGroups
- {
- get
- { return _isDefaultShowGroups; }
- set
- { _isDefaultShowGroups = value; }
- }
- /// <summary>
- /// 默认显示分组
- /// </summary>
- public bool DefaultShowGroups = true;
- /// <summary>
- /// 默认不显示分组
- /// </summary>
- public bool DefaultNotShowGroups = false;
- const int WM_HSCROLL = 0x0114;
- const int WM_VSCROLL = 0x0115;
- /// <summary>
- /// 重写滚动条滚动事件
- /// </summary>
- /// <param name="m"></param>
- protected override void WndProc(ref Message m)
- {
- if (m.Msg == WM_HSCROLL)
- { OnHScroll(this, new EventArgs()); }
- else if (m.Msg == WM_VSCROLL)
- { OnVScroll(this, new EventArgs()); }
- base.WndProc(ref m);
- }
- /// <summary>
- /// 滚动条滚动事件
- /// </summary>
- public event EventHandler Scroll;
- /// <summary>
- /// 重写滚动条滚动事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- virtual protected void OnHScroll(object sender, EventArgs e)
- {
- if (Scroll != null)
- Scroll(this, e);
- }
- /// <summary>
- /// 重写滚动条滚动事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- virtual protected void OnVScroll(object sender, EventArgs e)
- {
- if (Scroll != null)
- Scroll(this, e);
- }
-
- }
- }
|