|
namespace RCM
{
#region Directives
using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Drawing;
#endregion
[System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")]
public class cListView : IDisposable
{
#region Constants
private const int LVM_FIRST = 0x1000;
private const int LVM_GETHEADER = (LVM_FIRST + 31);
#endregion
#region API
[DllImport("user32.dll")]
private static extern IntPtr SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
#endregion
#region Fields
private IntPtr _hListviewWnd = IntPtr.Zero;
private cHeader _cHeaderSkin;
private cInternalScrollBar _cInternalScroll;
#endregion
#region Constructor
public cListView(IntPtr handle, Bitmap header, Bitmap hztrack, Bitmap hzarrow, Bitmap hzthumb, Bitmap vttrack, Bitmap vtarrow, Bitmap vtthumb)
{
if (handle == IntPtr.Zero)
throw new Exception("The listview handle is invalid.");
_hListviewWnd = handle;
if (headerWnd != IntPtr.Zero)
_cHeaderSkin = new cHeader(headerWnd, header);
if (hztrack != null && hzarrow != null && hzthumb != null && vttrack != null && vtarrow != null && vtthumb != null)
_cInternalScroll = new cInternalScrollBar(_hListviewWnd, hztrack, hzarrow, hzthumb, vttrack, vtarrow, vtthumb);
else
throw new Exception("The listview image(s) are invalid");
}
private IntPtr headerWnd
{
get { return (SendMessage(_hListviewWnd, LVM_GETHEADER, 0, 0)); }
}
#endregion
#region Methods
public void Dispose()
{
try
{
if (_cHeaderSkin != null) _cHeaderSkin.Dispose();
if (_cInternalScroll != null) _cInternalScroll.Dispose();
}
catch { }
}
#endregion
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Network and programming specialist. Started in C, and have learned about 14 languages since then. Cisco programmer, and lately writing a lot of C# and WPF code, (learning Java too). If I can dream it up, I can probably put it to code. My software company, (VTDev), is on the verge of releasing a couple of very cool things.. keep you posted.