Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2884 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
34 changed files with 237 additions and 9004 deletions
@ -1,7 +0,0 @@
@@ -1,7 +0,0 @@
|
||||
This Controls comes from: |
||||
|
||||
http://www.codeproject.com/cs/miscctrl/treelistview.asp |
||||
|
||||
I want to thank Thomas Caudal for his efforts. |
||||
|
||||
|
Binary file not shown.
@ -1,27 +0,0 @@
@@ -1,27 +0,0 @@
|
||||
using System; |
||||
|
||||
namespace System.Runtime.InteropServices.APIs |
||||
{ |
||||
/// <summary>
|
||||
/// Summary description for Clipboard.
|
||||
/// </summary>
|
||||
public class APIsClipboard |
||||
{ |
||||
public static bool ClearClipboard(IntPtr hWnd) |
||||
{ |
||||
if(!OpenClipboard(hWnd)) return false; |
||||
bool res = EmptyClipboard(); |
||||
CloseClipboard(); |
||||
return res; |
||||
} |
||||
|
||||
[DllImport("user32.dll")] |
||||
protected static extern bool EmptyClipboard(); |
||||
|
||||
[DllImport("user32.dll")] |
||||
protected static extern bool OpenClipboard(IntPtr hWnd); |
||||
|
||||
[DllImport("user32.dll")] |
||||
protected static extern bool CloseClipboard(); |
||||
} |
||||
} |
@ -1,22 +0,0 @@
@@ -1,22 +0,0 @@
|
||||
using System; |
||||
|
||||
namespace System.Runtime.InteropServices.APIs |
||||
{ |
||||
public class APIsComctl32 |
||||
{ |
||||
#region GetMajorVersion
|
||||
public static int GetMajorVersion() |
||||
{ |
||||
APIsStructs.DLLVERSIONINFO2 pdvi = new APIsStructs.DLLVERSIONINFO2(); |
||||
pdvi.info1.cbSize = Marshal.SizeOf(typeof(APIsStructs.DLLVERSIONINFO2)); |
||||
DllGetVersion(ref pdvi); |
||||
return pdvi.info1.dwMajorVersion; |
||||
} |
||||
#endregion
|
||||
#region DllGetVersion
|
||||
[DllImport("Comctl32.dll", CharSet=CharSet.Auto)] |
||||
static private extern int DllGetVersion( |
||||
ref APIsStructs.DLLVERSIONINFO2 pdvi); |
||||
#endregion
|
||||
} |
||||
} |
File diff suppressed because it is too large
Load Diff
@ -1,64 +0,0 @@
@@ -1,64 +0,0 @@
|
||||
using System; |
||||
|
||||
namespace System.Runtime.InteropServices.APIs |
||||
{ |
||||
public class APIsGdi |
||||
{ |
||||
[DllImport("gdi32.dll", CharSet=CharSet.Auto)] |
||||
static public extern bool TransparentBlt( |
||||
IntPtr hdcDest, int nXOriginDest, int nYOriginDest, int nWidthDest, int hHeightDest, |
||||
IntPtr hdcSrc, int nXOriginSrc, int nYOriginSrc, int nWidthSrc, int hHeightSrc, |
||||
int crTransparent); |
||||
[DllImport("gdi32.dll", CharSet=CharSet.Auto)] |
||||
static public extern IntPtr GetDC(IntPtr hWnd); |
||||
[DllImport("gdi32.dll")] |
||||
static public extern bool StretchBlt(IntPtr hDCDest, int XOriginDest, int YOriginDest, int WidthDest, int HeightDest, |
||||
IntPtr hDCSrc, int XOriginScr, int YOriginSrc, int WidthScr, int HeightScr, APIsEnums.PatBltTypes Rop); |
||||
[DllImport("gdi32.dll")] |
||||
static public extern IntPtr CreateCompatibleDC(IntPtr hDC); |
||||
[DllImport("gdi32.dll")] |
||||
static public extern IntPtr CreateCompatibleBitmap(IntPtr hDC, int Width, int Heigth); |
||||
[DllImport("gdi32.dll")] |
||||
static public extern IntPtr SelectObject(IntPtr hDC, IntPtr hObject); |
||||
[DllImport("gdi32.dll")] |
||||
static public extern bool BitBlt(IntPtr hDCDest, int XOriginDest, int YOriginDest, int WidthDest, int HeightDest, |
||||
IntPtr hDCSrc, int XOriginScr, int YOriginSrc, APIsEnums.PatBltTypes flags); |
||||
[DllImport("gdi32.dll")] |
||||
static public extern IntPtr DeleteDC(IntPtr hDC); |
||||
[DllImport("gdi32.dll")] |
||||
static public extern bool PatBlt(IntPtr hDC, int XLeft, int YLeft, int Width, int Height, uint Rop); |
||||
[DllImport("gdi32.dll")] |
||||
static public extern bool DeleteObject(IntPtr hObject); |
||||
[DllImport("gdi32.dll")] |
||||
static public extern uint GetPixel(IntPtr hDC, int XPos, int YPos); |
||||
[DllImport("gdi32.dll")] |
||||
static public extern int SetMapMode(IntPtr hDC, int fnMapMode); |
||||
[DllImport("gdi32.dll")] |
||||
static public extern int GetObjectType(IntPtr handle); |
||||
[DllImport("gdi32")] |
||||
public static extern IntPtr CreateDIBSection(IntPtr hdc, ref APIsStructs.BITMAPINFO_FLAT bmi, |
||||
int iUsage, ref int ppvBits, IntPtr hSection, int dwOffset); |
||||
[DllImport("gdi32")] |
||||
public static extern int GetDIBits(IntPtr hDC, IntPtr hbm, int StartScan, int ScanLines, int lpBits, APIsStructs.BITMAPINFOHEADER bmi, int usage); |
||||
[DllImport("gdi32")] |
||||
public static extern int GetDIBits(IntPtr hdc, IntPtr hbm, int StartScan, int ScanLines, int lpBits, ref APIsStructs.BITMAPINFO_FLAT bmi, int usage); |
||||
[DllImport("gdi32")] |
||||
public static extern IntPtr GetPaletteEntries(IntPtr hpal, int iStartIndex, int nEntries, byte[] lppe); |
||||
[DllImport("gdi32")] |
||||
public static extern IntPtr GetSystemPaletteEntries(IntPtr hdc, int iStartIndex, int nEntries, byte[] lppe); |
||||
[DllImport("gdi32")] |
||||
public static extern uint SetDCBrushColor(IntPtr hdc, uint crColor); |
||||
[DllImport("gdi32")] |
||||
public static extern IntPtr CreateSolidBrush(uint crColor); |
||||
[DllImport("gdi32")] |
||||
public static extern int SetBkMode(IntPtr hDC, APIsEnums.BackgroundMode mode); |
||||
[DllImport("gdi32")] |
||||
public static extern int SetViewportOrgEx(IntPtr hdc, int x, int y, int param); |
||||
[DllImport("gdi32")] |
||||
public static extern uint SetTextColor(IntPtr hDC, uint colorRef); |
||||
[DllImport("gdi32")] |
||||
public static extern int SetStretchBltMode(IntPtr hDC, APIsEnums.StrechModeFlags StrechMode); |
||||
[DllImport("gdi32")] |
||||
public static extern uint SetPixel(IntPtr hDC, int x, int y, uint color); |
||||
} |
||||
} |
@ -1,43 +0,0 @@
@@ -1,43 +0,0 @@
|
||||
using System; |
||||
|
||||
namespace System.Runtime.InteropServices.APIs |
||||
{ |
||||
public class APIsMenu |
||||
{ |
||||
[DllImport("user32.dll")] |
||||
public static extern APIsEnums.MenuItemFlags GetMenuState( |
||||
IntPtr hMenu, int itemID, APIsEnums.MenuItemFlags uFlag); |
||||
[DllImport("user32.dll")] |
||||
public static extern bool GetMenuString( |
||||
IntPtr hMenu, int itemID, System.Text.StringBuilder lpString, int maxlen, APIsEnums.MenuItemFlags uFlag); |
||||
[DllImport("user32.dll")] |
||||
public static extern int GetMenuItemInfo( |
||||
IntPtr hMenu, int itemindex, bool fByPosition, ref APIsStructs.MENUITMEINFO infos); |
||||
[DllImport("user32.dll")] |
||||
public static extern int GetMenuItemID( |
||||
IntPtr hMenu, int index); |
||||
[DllImport("user32.dll")] |
||||
public static extern bool InsertMenuItem( |
||||
IntPtr hMenu, int itemindex, bool fByPosition, ref APIsStructs.MENUITMEINFO infos); |
||||
[DllImport("user32.dll")] |
||||
public static extern int GetMenuItemCount(IntPtr hMenu); |
||||
[DllImport("user32.dll")] |
||||
public static extern IntPtr CreatePopupMenu(); |
||||
[DllImport("user32.dll")] |
||||
public static extern bool DestroyMenu(IntPtr hMenu); |
||||
[DllImport("user32.dll")] |
||||
public static extern bool DeleteMenu( |
||||
IntPtr hMenu, |
||||
int index, |
||||
APIsEnums.MenuItemFlags uFlag); |
||||
[DllImport("user32.dll", SetLastError=true)] |
||||
public static extern int TrackPopupMenu( |
||||
IntPtr hmenu, |
||||
APIsEnums.TrackPopupMenuFlags fuFlags, |
||||
int x, |
||||
int y, |
||||
int res, |
||||
IntPtr hwnd, |
||||
IntPtr rect); |
||||
} |
||||
} |
@ -1,253 +0,0 @@
@@ -1,253 +0,0 @@
|
||||
using System; |
||||
using System.IO; |
||||
|
||||
namespace System.Runtime.InteropServices.APIs |
||||
{ |
||||
public class APIsShell |
||||
{ |
||||
#region GetShellFolder function
|
||||
public static COMInterfaces.IShellFolder GetShellFolder(IntPtr handle, string path, out IntPtr FolderID) |
||||
{ |
||||
string tempPath = path; |
||||
|
||||
// Get the desktop folder
|
||||
COMInterfaces.IShellFolder returnedShellFolder = null; |
||||
APIsShell.SHGetDesktopFolder(out returnedShellFolder); |
||||
|
||||
System.Guid IID_IShellFolder = new System.Guid("000214E6-0000-0000-C000-000000000046"); |
||||
IntPtr Pidl = IntPtr.Zero; |
||||
uint i,j=0; |
||||
// Connect to "My Computer"
|
||||
APIsShell.SHGetSpecialFolderLocation(handle, APIsEnums.ShellSpecialFolders.DRIVES, out Pidl); |
||||
COMInterfaces.IShellFolder tempfolder; |
||||
returnedShellFolder.BindToObject(Pidl, IntPtr.Zero, ref IID_IShellFolder, out tempfolder); |
||||
Marshal.ReleaseComObject(returnedShellFolder); |
||||
returnedShellFolder = tempfolder; |
||||
int lastindexposition = 0; |
||||
while(lastindexposition != -1) |
||||
{ |
||||
lastindexposition = tempPath.IndexOf('\\'); |
||||
if(lastindexposition == -1) break; |
||||
string foldername = tempPath.Remove(lastindexposition, tempPath.Length - lastindexposition) + @"\"; |
||||
returnedShellFolder.ParseDisplayName(handle, IntPtr.Zero, foldername, out i, out Pidl, ref j); |
||||
returnedShellFolder.BindToObject(Pidl, IntPtr.Zero, ref IID_IShellFolder, out tempfolder); |
||||
Marshal.ReleaseComObject(returnedShellFolder); |
||||
returnedShellFolder = tempfolder; |
||||
tempPath = tempPath.Substring(++lastindexposition); |
||||
} |
||||
FolderID = Pidl; |
||||
return(returnedShellFolder); |
||||
} |
||||
#endregion
|
||||
#region Copy, Delete, Move, Rename
|
||||
public static bool DoOperation(IntPtr Handle, string[] source, string dest, APIsEnums.FileOperations operation) |
||||
{ |
||||
APIsStructs.SHFILEOPSTRUCT fileop = new APIsStructs.SHFILEOPSTRUCT(); |
||||
fileop.hwnd = Handle; |
||||
fileop.lpszProgressTitle = Enum.GetName(typeof(APIsEnums.FileOperations), operation); |
||||
fileop.wFunc = (uint) operation; |
||||
fileop.pFrom = Marshal.StringToHGlobalUni(StringArrayToMultiString(source)); |
||||
fileop.pTo = Marshal.StringToHGlobalUni(dest); |
||||
fileop.fAnyOperationsAborted = 0; |
||||
fileop.hNameMappings = IntPtr.Zero; |
||||
|
||||
return SHFileOperation(ref fileop) == 0; |
||||
} |
||||
private static String StringArrayToMultiString(String[] stringArray) |
||||
{ |
||||
String multiString = ""; |
||||
|
||||
if (stringArray == null) |
||||
return ""; |
||||
|
||||
for (int i=0 ; i<stringArray.Length ; i++) |
||||
multiString += stringArray[i] + '\0'; |
||||
|
||||
multiString += '\0'; |
||||
|
||||
return multiString; |
||||
} |
||||
#endregion
|
||||
#region Properties Launch
|
||||
public static int ViewFileProperties(string path) |
||||
{ |
||||
if(!File.Exists(path)) return(-1); |
||||
APIsStructs.SHELLEXECUTEINFO info = new APIsStructs.SHELLEXECUTEINFO(); |
||||
info.cbSize = Marshal.SizeOf(typeof(APIsStructs.SHELLEXECUTEINFO)); |
||||
info.fMask = APIsEnums.ShellExecuteFlags.INVOKEIDLIST; |
||||
info.hWnd = IntPtr.Zero; |
||||
info.lpVerb = "properties"; |
||||
info.lpFile = Path.GetFileName(path); |
||||
info.lpParameters = ""; |
||||
info.lpDirectory = Path.GetDirectoryName(path); |
||||
info.nShow = APIsEnums.ShowWindowStyles.SHOW; |
||||
info.hInstApp = IntPtr.Zero; |
||||
IntPtr ptr = Marshal.AllocCoTaskMem(Marshal.SizeOf(typeof(APIsStructs.SHELLEXECUTEINFO))); |
||||
Marshal.StructureToPtr(info, ptr, false); |
||||
return(ShellExecuteEx(ptr)); |
||||
} |
||||
public static int ViewDirectoryProperties(string path) |
||||
{ |
||||
if(!Directory.Exists(path)) return(-1); |
||||
APIsStructs.SHELLEXECUTEINFO info = new APIsStructs.SHELLEXECUTEINFO(); |
||||
info.cbSize = Marshal.SizeOf(typeof(APIsStructs.SHELLEXECUTEINFO)); |
||||
info.fMask = APIsEnums.ShellExecuteFlags.INVOKEIDLIST; |
||||
info.hWnd = IntPtr.Zero; |
||||
info.lpVerb = "properties"; |
||||
info.lpFile = ""; |
||||
info.lpParameters = ""; |
||||
info.lpDirectory = path; |
||||
info.nShow = APIsEnums.ShowWindowStyles.SHOW; |
||||
info.hInstApp = IntPtr.Zero; |
||||
IntPtr ptr = Marshal.AllocCoTaskMem(Marshal.SizeOf(typeof(APIsStructs.SHELLEXECUTEINFO))); |
||||
Marshal.StructureToPtr(info, ptr, false); |
||||
return(ShellExecuteEx(ptr)); |
||||
} |
||||
#endregion
|
||||
#region GetIcon
|
||||
static uint FILE_ATTRIBUTE_DIRECTORY = 0x00000010; |
||||
static uint FILE_ATTRIBUTE_NORMAL = 0x00000080; |
||||
public static System.Drawing.Icon GetFileIcon(string strPath, bool bSmall) |
||||
{ |
||||
APIsStructs.SHFILEINFO info = new APIsStructs.SHFILEINFO(true); |
||||
APIsEnums.ShellGetFileInformationFlags flags = |
||||
APIsEnums.ShellGetFileInformationFlags.Icon | |
||||
(File.Exists(strPath) ? 0 : APIsEnums.ShellGetFileInformationFlags.UseFileAttributes) | |
||||
(bSmall ? APIsEnums.ShellGetFileInformationFlags.SmallIcon : APIsEnums.ShellGetFileInformationFlags.LargeIcon); |
||||
SHGetFileInfo(strPath, |
||||
FILE_ATTRIBUTE_NORMAL, |
||||
out info, |
||||
(uint)Marshal.SizeOf(info), |
||||
flags); |
||||
System.Drawing.Icon icon = System.Drawing.Icon.FromHandle(info.hIcon); |
||||
return icon; |
||||
} |
||||
public static System.Drawing.Icon GetFolderIcon(string strPath, bool bSmall, bool bOpen) |
||||
{ |
||||
APIsStructs.SHFILEINFO info = new APIsStructs.SHFILEINFO(true); |
||||
APIsEnums.ShellGetFileInformationFlags flags = |
||||
APIsEnums.ShellGetFileInformationFlags.Icon | |
||||
(bSmall ? APIsEnums.ShellGetFileInformationFlags.SmallIcon : APIsEnums.ShellGetFileInformationFlags.LargeIcon) | |
||||
(bOpen ? APIsEnums.ShellGetFileInformationFlags.OpenIcon : 0) | |
||||
(Directory.Exists(strPath) ? 0 : APIsEnums.ShellGetFileInformationFlags.UseFileAttributes); |
||||
SHGetFileInfo(strPath, |
||||
FILE_ATTRIBUTE_DIRECTORY, |
||||
out info, |
||||
(uint)Marshal.SizeOf(info), |
||||
flags); |
||||
System.Drawing.Icon icon = System.Drawing.Icon.FromHandle(info.hIcon); |
||||
return icon; |
||||
} |
||||
#endregion
|
||||
|
||||
#region SHParseDisplayName
|
||||
[DllImport("shell32.dll")] |
||||
public static extern Int32 SHParseDisplayName( |
||||
[MarshalAs(UnmanagedType.LPWStr)] |
||||
String pszName, |
||||
IntPtr pbc, |
||||
out IntPtr ppidl, |
||||
UInt32 sfgaoIn, |
||||
out UInt32 psfgaoOut); |
||||
#endregion
|
||||
#region SHGetDataFromIDList
|
||||
[DllImport("shell32.dll", CharSet=CharSet.Auto)] |
||||
public static extern uint SHGetDataFromIDList( |
||||
COMInterfaces.IShellFolder psf, |
||||
IntPtr pidl, |
||||
APIsEnums.ShellFolderGetaFromIDList nFormat, |
||||
out APIsStructs.WIN32_FIND_DATA pv, |
||||
int cb); |
||||
#endregion
|
||||
#region SHGetPathFromIDList
|
||||
[DllImport("Shell32.Dll", CharSet=CharSet.Auto)] |
||||
[return:MarshalAs(UnmanagedType.Bool)] |
||||
public static extern Boolean SHGetPathFromIDList( |
||||
IntPtr pidl, |
||||
[In,Out,MarshalAs(UnmanagedType.LPTStr)] String pszPath); |
||||
#endregion
|
||||
#region SHGetSpecialFolderPath
|
||||
[DllImport("Shell32.Dll", CharSet=CharSet.Auto)] |
||||
[return:MarshalAs(UnmanagedType.Bool)] |
||||
public static extern Boolean SHGetSpecialFolderPath( |
||||
IntPtr hwndOwner, |
||||
[In,Out,MarshalAs(UnmanagedType.LPTStr)] String pszPath, |
||||
APIsEnums.ShellSpecialFolders nFolder, |
||||
[In,MarshalAs(UnmanagedType.Bool)] Boolean fCreate); |
||||
#endregion
|
||||
#region SHGetDesktopFolder
|
||||
/// <summary>
|
||||
/// Retrieves the IShellFolder interface for the desktop folder, which is the root of the Shell's namespace.
|
||||
/// </summary>
|
||||
[DllImport("shell32.dll")] |
||||
public static extern int SHGetDesktopFolder(out COMInterfaces.IShellFolder folder); |
||||
#endregion
|
||||
#region SHGetSpecialFolderLocation
|
||||
/// <summary>
|
||||
/// Retrieves a pointer to the ITEMIDLIST structure of a special folder.
|
||||
/// </summary>
|
||||
[DllImport("shell32.dll")] |
||||
public static extern int SHGetSpecialFolderLocation( |
||||
IntPtr handle, |
||||
APIsEnums.ShellSpecialFolders nFolder, |
||||
out IntPtr ppidl); |
||||
#endregion
|
||||
#region SHBindToParent
|
||||
/// <summary>
|
||||
/// This function takes the fully-qualified PIDL of a namespace object, and returns a specified interface pointer on the parent object.
|
||||
/// </summary>
|
||||
[DllImport("shell32.dll")] |
||||
public static extern int SHBindToParent( |
||||
IntPtr pidl, |
||||
Guid iid, |
||||
out COMInterfaces.IShellFolder folder, |
||||
out IntPtr pidlRelative); |
||||
#endregion
|
||||
#region SHFileOperation
|
||||
/// <summary>
|
||||
/// Copies, moves, renames, or deletes a file system object.
|
||||
/// </summary>
|
||||
[DllImport("shell32.dll", CharSet=CharSet.Unicode)] |
||||
public static extern Int32 SHFileOperation( |
||||
ref APIsStructs.SHFILEOPSTRUCT FileOp); |
||||
#endregion
|
||||
#region SHGetFileInfo
|
||||
[DllImport("Shell32.dll")] |
||||
public static extern int SHGetFileInfo( |
||||
string pszPath, |
||||
uint dwFileAttributes, |
||||
out APIsStructs.SHFILEINFO psfi, |
||||
uint cbfileInfo, |
||||
APIsEnums.ShellGetFileInformationFlags uFlags); |
||||
#endregion
|
||||
#region ShellExecute
|
||||
/// <summary>
|
||||
/// Execute the file
|
||||
/// </summary>
|
||||
[DllImport("Shell32.dll")] |
||||
public static extern int ShellExecute |
||||
(IntPtr Hwnd, |
||||
string strOperation, |
||||
string strFile, |
||||
string strParametres, |
||||
string strDirectory, |
||||
int ShowCmd); |
||||
#endregion
|
||||
#region ShellExecuteEx
|
||||
[DllImport("Shell32.dll")] |
||||
public static extern int ShellExecuteEx(IntPtr infos); |
||||
#endregion
|
||||
|
||||
#region StrRetToBuf
|
||||
/// <summary>
|
||||
/// Takes a STRRET structure returned by IShellFolder::GetDisplayNameOf, converts it to a string, and places the result in a buffer.
|
||||
/// </summary>
|
||||
[DllImport("Shlwapi.Dll", CharSet=CharSet.Auto)] |
||||
public static extern uint StrRetToBuf( |
||||
APIsStructs.STRRET pstr, |
||||
IntPtr pidl, |
||||
[In,Out,MarshalAs(UnmanagedType.LPTStr)] String pszBuf, |
||||
uint cchBuf); |
||||
#endregion
|
||||
} |
||||
} |
@ -1,215 +0,0 @@
@@ -1,215 +0,0 @@
|
||||
using System; |
||||
|
||||
namespace System.Runtime.InteropServices.APIs |
||||
{ |
||||
public class APIsShlwapi |
||||
{ |
||||
#region PathCompactPath
|
||||
/// <summary>
|
||||
/// Truncates a file path to fit within a given pixel width by replacing path components with ellipses.
|
||||
/// </summary>
|
||||
/// <param name="hDC"></param>
|
||||
/// <param name="lpszPath"></param>
|
||||
/// <param name="dx"></param>
|
||||
/// <returns>Returns TRUE if the path was successfully compacted to the specified width. Returns FALSE on failure, or if the base portion of the path would not fit the specified width</returns>
|
||||
[DllImport("shlwapi.dll", CharSet=CharSet.Auto)] |
||||
static public extern bool PathCompactPath( |
||||
IntPtr hDC, |
||||
System.Text.StringBuilder lpszPath, |
||||
int dx); |
||||
#endregion
|
||||
#region PathCompactPathEx
|
||||
/// <summary>
|
||||
/// Truncates a path to fit within a certain number of characters by replacing path components with ellipses
|
||||
/// </summary>
|
||||
/// <param name="pszOut"></param>
|
||||
/// <param name="pszSrc"></param>
|
||||
/// <param name="cchMax"></param>
|
||||
/// <param name="dwFlags"></param>
|
||||
/// <returns>Returns TRUE if successful, or FALSE otherwise</returns>
|
||||
[DllImport("shlwapi.dll", CharSet=CharSet.Auto)] |
||||
static public extern bool PathCompactPathEx( |
||||
System.Text.StringBuilder pszOut, |
||||
System.Text.StringBuilder pszSrc, |
||||
int cchMax, |
||||
int dwFlags); |
||||
#endregion
|
||||
#region PathIsFileSpec
|
||||
/// <summary>
|
||||
/// Searches a path for any path delimiting characters (for example, ':' or '\' ). If there are no path delimiting characters present, the path is considered to be a File Spec path
|
||||
/// </summary>
|
||||
/// <param name="path">Path searched</param>
|
||||
/// <returns>Returns TRUE if there are no path delimiting characters within the path, or FALSE if there are path delimiting characters</returns>
|
||||
[DllImport("shlwapi.dll", CharSet=CharSet.Auto)] |
||||
static public extern bool PathIsFileSpec( |
||||
string path); |
||||
#endregion
|
||||
#region PathIsPrefix
|
||||
/// <summary>
|
||||
/// Searches a path to determine if it contains a valid prefix of the type passed by pszPrefix. A prefix is one of these types: "C:\\", ".", "..", "..\\"
|
||||
/// </summary>
|
||||
/// <param name="prefix"></param>
|
||||
/// <param name="path"></param>
|
||||
/// <returns>Returns TRUE if the compared path is the full prefix for the path, or FALSE otherwise</returns>
|
||||
[DllImport("shlwapi.dll", CharSet=CharSet.Auto)] |
||||
static public extern bool PathIsPrefix( |
||||
string prefix, |
||||
string path); |
||||
#endregion
|
||||
#region PathIsRelative
|
||||
/// <summary>
|
||||
/// Searches a path and determines if it is relative
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <returns>Returns TRUE if the path is relative, or FALSE if it is absolute</returns>
|
||||
[DllImport("shlwapi.dll", CharSet=CharSet.Auto)] |
||||
static public extern bool PathIsRelative( |
||||
string path); |
||||
#endregion
|
||||
#region PathIsRoot
|
||||
/// <summary>
|
||||
/// Parses a path to determine if it is a directory root
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <returns>Returns TRUE if the specified path is a root, or FALSE otherwise</returns>
|
||||
[DllImport("shlwapi.dll", CharSet=CharSet.Auto)] |
||||
static public extern bool PathIsRoot( |
||||
string path); |
||||
#endregion
|
||||
#region PathIsSameRoot
|
||||
/// <summary>
|
||||
/// Compares two paths to determine if they have a common root component
|
||||
/// </summary>
|
||||
/// <param name="path1"></param>
|
||||
/// <param name="path2"></param>
|
||||
/// <returns>Returns TRUE if both strings have the same root component, or FALSE otherwise</returns>
|
||||
[DllImport("shlwapi.dll", CharSet=CharSet.Auto)] |
||||
static public extern bool PathIsSameRoot( |
||||
string path1, |
||||
string path2); |
||||
#endregion
|
||||
#region PathIsUNC
|
||||
/// <summary>
|
||||
/// Determines if the string is a valid UNC (universal naming convention) for a server and share path
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <returns>Returns TRUE if the string is a valid UNC path, or FALSE otherwise</returns>
|
||||
[DllImport("shlwapi.dll", CharSet=CharSet.Auto)] |
||||
static public extern bool PathIsUNC( |
||||
string path); |
||||
#endregion
|
||||
#region PathIsUNCServer
|
||||
/// <summary>
|
||||
/// Determines if a string is a valid UNC (universal naming convention) for a server path only
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <returns>Returns TRUE if the string is a valid UNC path for a server only (no share name), or FALSE otherwise</returns>
|
||||
[DllImport("shlwapi.dll", CharSet=CharSet.Auto)] |
||||
static public extern bool PathIsUNCServer( |
||||
string path); |
||||
#endregion
|
||||
#region PathIsUNCServerShare
|
||||
/// <summary>
|
||||
/// Determines if a string is a valid universal naming convention (UNC) share path, \\server\share
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <returns>Returns TRUE if the string is in the form \\server\share, or FALSE otherwise</returns>
|
||||
[DllImport("shlwapi.dll", CharSet=CharSet.Auto)] |
||||
static public extern bool PathIsUNCServerShare( |
||||
string path); |
||||
#endregion
|
||||
#region PathIsURL
|
||||
/// <summary>
|
||||
/// Tests a given string to determine if it conforms to a valid URL format
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <returns>Returns TRUE if pszPath has a valid URL format, or FALSE otherwise</returns>
|
||||
[DllImport("shlwapi.dll", CharSet=CharSet.Auto)] |
||||
static public extern bool PathIsURL( |
||||
string path); |
||||
#endregion
|
||||
#region PathMakePretty
|
||||
/// <summary>
|
||||
/// Converts a path to all lowercase characters to give the path a consistent appearance
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <returns>Returns TRUE if the path has been converted, or FALSE otherwise</returns>
|
||||
[DllImport("shlwapi.dll", CharSet=CharSet.Auto)] |
||||
static public extern bool PathMakePretty( |
||||
System.Text.StringBuilder path); |
||||
#endregion
|
||||
#region PathMatchSpec
|
||||
/// <summary>
|
||||
/// Searches a string using a DOS wild card match type
|
||||
/// </summary>
|
||||
/// <param name="fileparam">Contains the path to be searched</param>
|
||||
/// <param name="spec">Contains the file type for which to search. For example, to test whether or not pszFileParam is a DOC file, pszSpec should be set to "*.doc"</param>
|
||||
/// <returns>Returns TRUE if the string matches, or FALSE otherwise</returns>
|
||||
[DllImport("shlwapi.dll", CharSet=CharSet.Auto)] |
||||
static public extern bool PathMatchSpec( |
||||
string fileparam, |
||||
string spec); |
||||
#endregion
|
||||
#region PathParseIconLocation
|
||||
/// <summary>
|
||||
/// Parses a file location string containing a file location and icon index, and returns separate values
|
||||
/// </summary>
|
||||
/// <param name="IconFile">Contains a file location string. It should be in the form "pathname,iconindex". When the function returns, pszIconFile will point to the file's pathname</param>
|
||||
/// <returns>Returns the valid icon index value</returns>
|
||||
[DllImport("shlwapi.dll", CharSet=CharSet.Auto)] |
||||
static public extern int PathParseIconLocation( |
||||
System.Text.StringBuilder IconFile); |
||||
#endregion
|
||||
#region PathQuoteSpaces
|
||||
/// <summary>
|
||||
/// Searches a path for spaces. If spaces are found, the entire path is enclosed in quotation marks
|
||||
/// </summary>
|
||||
/// <param name="lpsz">Path to search</param>
|
||||
[DllImport("shlwapi.dll", CharSet=CharSet.Auto)] |
||||
static public extern void PathQuoteSpaces( |
||||
System.Text.StringBuilder lpsz); |
||||
#endregion
|
||||
#region PathRelativePathTo
|
||||
/// <summary>
|
||||
/// Creates a relative path from one file or folder to another
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="from"></param>
|
||||
/// <param name="attrFrom"></param>
|
||||
/// <param name="to"></param>
|
||||
/// <param name="attrTo"></param>
|
||||
/// <returns>Returns TRUE if successful, or FALSE otherwise</returns>
|
||||
[DllImport("shlwapi.dll", CharSet=CharSet.Auto)] |
||||
static public extern bool PathRelativePathTo( |
||||
System.Text.StringBuilder path, |
||||
string from, |
||||
int attrFrom, |
||||
string to, |
||||
int attrTo); |
||||
#endregion
|
||||
#region PathRemoveArgs
|
||||
/// <summary>
|
||||
/// Removes any arguments from a given path
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
[DllImport("shlwapi.dll", CharSet=CharSet.Auto)] |
||||
static public extern void PathRemoveArgs( |
||||
System.Text.StringBuilder path); |
||||
#endregion
|
||||
#region PathRemoveBackslash
|
||||
/// <summary>
|
||||
/// Removes the trailing backslash from a given path
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <returns>Returns the address of the NULL that replaced the backslash, or the address of the last character if it's not a backslash</returns>
|
||||
[DllImport("shlwapi.dll", CharSet=CharSet.Auto)] |
||||
static public extern string PathRemoveBackslash( |
||||
string path); |
||||
#endregion
|
||||
#region DllGetVersion
|
||||
[DllImport("shlwapi.dll", CharSet=CharSet.Auto)] |
||||
static public extern int DllGetVersion( |
||||
ref APIsStructs.DLLVERSIONINFO2 path); |
||||
#endregion
|
||||
} |
||||
} |
@ -1,693 +0,0 @@
@@ -1,693 +0,0 @@
|
||||
using System; |
||||
|
||||
namespace System.Runtime.InteropServices.APIs |
||||
{ |
||||
public class APIsStructs |
||||
{ |
||||
#region DLLVERSIONINFO
|
||||
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)] |
||||
public struct DLLVERSIONINFO |
||||
{ |
||||
public int cbSize; |
||||
public int dwMajorVersion; |
||||
public int dwMinorVersion; |
||||
public int dwBuildNumber; |
||||
public int dwPlatformID; |
||||
} |
||||
#endregion
|
||||
#region DLLVERSIONINFO2
|
||||
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)] |
||||
public struct DLLVERSIONINFO2 |
||||
{ |
||||
public DLLVERSIONINFO info1; |
||||
public int dwFlags; |
||||
ulong ullVersion; |
||||
} |
||||
#endregion
|
||||
#region WIN32_FIND_DATA
|
||||
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)] |
||||
public struct WIN32_FIND_DATA |
||||
{ |
||||
public uint fileAttributes; |
||||
public System.Runtime.InteropServices.ComTypes.FILETIME creationTime; |
||||
public System.Runtime.InteropServices.ComTypes.FILETIME lastAccessTime; |
||||
public System.Runtime.InteropServices.ComTypes.FILETIME lastWriteTime; |
||||
public uint fileSizeHigh; |
||||
public uint fileSizeLow; |
||||
public uint reserved0; |
||||
public uint reserved1; |
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=260)] |
||||
public string fileName; |
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=14)] |
||||
public string alternateFileName; |
||||
} |
||||
#endregion
|
||||
|
||||
#region SHITEMIDLIST
|
||||
[StructLayout(LayoutKind.Sequential)] |
||||
public struct SHITEMIDLIST |
||||
{ |
||||
public SHITEMID[] mkid; |
||||
} |
||||
#endregion
|
||||
#region SHITEMID
|
||||
[StructLayout(LayoutKind.Sequential)] |
||||
public struct SHITEMID |
||||
{ |
||||
public ushort cb; |
||||
public byte abID; |
||||
} |
||||
#endregion
|
||||
#region SHFILEOPSTRUCT
|
||||
/// <summary>
|
||||
/// Contains information that the SHFileOperation function uses to perform file operations.
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)] |
||||
public struct SHFILEOPSTRUCT |
||||
{ |
||||
/// <summary>
|
||||
/// Window handle to the dialog box to display information about the status of the file operation.
|
||||
/// </summary>
|
||||
public IntPtr hwnd; |
||||
/// <summary>
|
||||
/// Value that indicates which operation to perform.
|
||||
/// </summary>
|
||||
public UInt32 wFunc; |
||||
/// <summary>
|
||||
/// Address of a buffer to specify one or more source file names.
|
||||
/// </summary>
|
||||
public IntPtr pFrom; |
||||
/// <summary>
|
||||
/// Address of a buffer to contain the name of the destination file or directory.
|
||||
/// </summary>
|
||||
public IntPtr pTo; |
||||
/// <summary>
|
||||
/// Flags that control the file operation (should use APISEnums.FOF).
|
||||
/// </summary>
|
||||
public UInt16 fFlags; |
||||
/// <summary>
|
||||
/// Value that receives TRUE if the user aborted any file operations before they were completed, or FALSE otherwise.
|
||||
/// </summary>
|
||||
public Int32 fAnyOperationsAborted; |
||||
/// <summary>
|
||||
/// A handle to a name mapping object containing the old and new names of the renamed files.
|
||||
/// </summary>
|
||||
public IntPtr hNameMappings; |
||||
/// <summary>
|
||||
/// Address of a string to use as the title of a progress dialog box.
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.LPWStr)] public string lpszProgressTitle; |
||||
} |
||||
#endregion
|
||||
#region SHELLEXECUTEINFO
|
||||
[StructLayoutAttribute(LayoutKind.Sequential)] |
||||
public struct SHELLEXECUTEINFO |
||||
{ |
||||
public int cbSize; |
||||
public APIsEnums.ShellExecuteFlags fMask; |
||||
public IntPtr hWnd; |
||||
public string lpVerb; |
||||
public string lpFile; |
||||
public string lpParameters; |
||||
public string lpDirectory; |
||||
public APIsEnums.ShowWindowStyles nShow; |
||||
public IntPtr hInstApp; |
||||
public IntPtr lpIDList; |
||||
public int lpClass; |
||||
public int hkeyClass; |
||||
public int dwHotKey; |
||||
public IntPtr hIcon; |
||||
public IntPtr hProcess; |
||||
} |
||||
#endregion
|
||||
#region SHFILEINFO
|
||||
[StructLayout(LayoutKind.Sequential)] |
||||
public struct SHFILEINFO |
||||
{ |
||||
public SHFILEINFO(bool b) |
||||
{ |
||||
hIcon=IntPtr.Zero;iIcon=0;dwAttributes=0;szDisplayName="";szTypeName=""; |
||||
} |
||||
public IntPtr hIcon; |
||||
public int iIcon; |
||||
public uint dwAttributes; |
||||
[MarshalAs(UnmanagedType.LPStr, SizeConst=260)] |
||||
public string szDisplayName; |
||||
[MarshalAs(UnmanagedType.LPStr, SizeConst=80)] |
||||
public string szTypeName; |
||||
}; |
||||
#endregion
|
||||
|
||||
#region STRRET
|
||||
[StructLayout(LayoutKind.Sequential)] |
||||
public struct STRRET |
||||
{ |
||||
public int uType; |
||||
// IntPtr pOleStr;
|
||||
// uint uOffset;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst=260)] public byte[] cStr; |
||||
} |
||||
#endregion
|
||||
#region MENUITMEINFO
|
||||
[StructLayoutAttribute(LayoutKind.Sequential)] |
||||
public struct MENUITMEINFO |
||||
{ |
||||
public int cbSize; |
||||
public APIsEnums.MenuItemMasks fMask; |
||||
public APIsEnums.MenuItemTypes fType; |
||||
public APIsEnums.MenuItemStates fState; |
||||
public int wID; |
||||
public IntPtr hSubMenu; |
||||
public IntPtr hbmpChecked; |
||||
public IntPtr hbmpUnchecked; |
||||
public int dwItemData; |
||||
public IntPtr dwTypeData; |
||||
public int cch; |
||||
public IntPtr hbmpItem; |
||||
} |
||||
#endregion
|
||||
#region StartupInfo
|
||||
[StructLayout(LayoutKind.Sequential)] |
||||
public class StartupInfo |
||||
{ |
||||
public int cb; |
||||
public String lpReserved; |
||||
public String lpDesktop; |
||||
public String lpTitle; |
||||
public int dwX; |
||||
public int dwY; |
||||
public int dwXSize; |
||||
public int dwYSize; |
||||
public int dwXCountChars; |
||||
public int dwYCountChars; |
||||
public int dwFillAttribute; |
||||
public int dwFlags; |
||||
public UInt16 wShowWindow; |
||||
public UInt16 cbReserved2; |
||||
public Byte lpReserved2; |
||||
public int hStdInput; |
||||
public int hStdOutput; |
||||
public int hStdError; |
||||
} |
||||
#endregion
|
||||
#region ProcessInformation
|
||||
[StructLayout(LayoutKind.Sequential)] |
||||
public class ProcessInformation |
||||
{ |
||||
public int hProcess; |
||||
public int hThread; |
||||
public int dwProcessId; |
||||
public int dwThreadId; |
||||
} |
||||
#endregion
|
||||
#region MENUITEMINFO
|
||||
[StructLayout(LayoutKind.Sequential)] |
||||
public struct MENUITEMINFO |
||||
{ |
||||
public uint cbSize; |
||||
public uint fMask; |
||||
public uint fType; |
||||
public uint fState; |
||||
public int wID; |
||||
public int /*HMENU*/ hSubMenu; |
||||
public int /*HBITMAP*/ hbmpChecked; |
||||
public int /*HBITMAP*/ hbmpUnchecked; |
||||
public int /*ULONG_PTR*/ dwItemData; |
||||
public String dwTypeData; |
||||
public uint cch; |
||||
public int /*HBITMAP*/ hbmpItem; |
||||
} |
||||
#endregion
|
||||
#region FORMATETC
|
||||
[StructLayout(LayoutKind.Sequential)] |
||||
public struct FORMATETC |
||||
{ |
||||
public APIsEnums.ClipboardFormats cfFormat; |
||||
public uint ptd; |
||||
public APIsEnums.TargetDevices dwAspect; |
||||
public int lindex; |
||||
public APIsEnums.StorageMediumTypes tymed; |
||||
} |
||||
#endregion
|
||||
#region STGMEDIUM
|
||||
[StructLayout(LayoutKind.Sequential)] |
||||
public struct STGMEDIUM |
||||
{ |
||||
public uint tymed; |
||||
public uint hGlobal; |
||||
public uint pUnkForRelease; |
||||
} |
||||
#endregion
|
||||
#region CMINVOKECOMMANDINFO
|
||||
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)] |
||||
public struct CMINVOKECOMMANDINFO |
||||
{ |
||||
public int cbSize; // sizeof(CMINVOKECOMMANDINFO)
|
||||
public int fMask; // any combination of CMIC_MASK_*
|
||||
public IntPtr hwnd; // might be NULL (indicating no owner window)
|
||||
public IntPtr lpVerb; // either a string or MAKEINTRESOURCE(idOffset)
|
||||
public IntPtr lpParameters; // might be NULL (indicating no parameter)
|
||||
public IntPtr lpDirectory; // might be NULL (indicating no specific directory)
|
||||
public int nShow; // one of SW_ values for ShowWindow() API
|
||||
public int dwHotKey; |
||||
public IntPtr hIcon; |
||||
} |
||||
#endregion
|
||||
|
||||
#region LV_ITEM
|
||||
[StructLayoutAttribute(LayoutKind.Sequential)] |
||||
public struct LV_ITEM |
||||
{ |
||||
public APIsEnums.ListViewItemFlags mask; |
||||
public Int32 iItem; |
||||
public Int32 iSubItem; |
||||
public APIsEnums.ListViewItemStates state; |
||||
public APIsEnums.ListViewItemStates stateMask; |
||||
public String pszText; |
||||
public Int32 cchTextMax; |
||||
public Int32 iImage; |
||||
public IntPtr lParam; |
||||
public Int32 iIndent; |
||||
} |
||||
#endregion
|
||||
#region LVCOLUMN
|
||||
[StructLayoutAttribute(LayoutKind.Sequential)] |
||||
public struct LVCOLUMN |
||||
{ |
||||
public Int32 mask; |
||||
public Int32 fmt; |
||||
public Int32 cx; |
||||
public string pszText; |
||||
public Int32 cchTextMax; |
||||
public Int32 iSubItem; |
||||
public Int32 iImage; |
||||
public Int32 iOrder; |
||||
} |
||||
#endregion
|
||||
#region LVHITTESTINFO
|
||||
[StructLayoutAttribute(LayoutKind.Sequential)] |
||||
public struct LVHITTESTINFO |
||||
{ |
||||
public POINTAPI pt; |
||||
public int flags; |
||||
public Int32 iItem; |
||||
public Int32 iSubItem; |
||||
} |
||||
#endregion
|
||||
#region NMLVDISPINFO
|
||||
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)] |
||||
public struct NMLVDISPINFO |
||||
{ |
||||
public NMHDR hdr; |
||||
public LV_ITEM lvitem; |
||||
} |
||||
#endregion
|
||||
#region NMLISTVIEW
|
||||
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)] |
||||
public struct NMLISTVIEW |
||||
{ |
||||
public NMHDR nmhdr; |
||||
public int iItem; |
||||
public int iSubItem; |
||||
public uint uNewState; |
||||
public uint uOldState; |
||||
public uint uChanged; |
||||
public POINTAPI ptAction; |
||||
public IntPtr lParam; |
||||
public bool NewSelected |
||||
{ |
||||
get |
||||
{ |
||||
return ((APIsEnums.ListViewItemStates)uNewState & APIsEnums.ListViewItemStates.SELECTED) == APIsEnums.ListViewItemStates.SELECTED; |
||||
} |
||||
} |
||||
public bool OldSelected |
||||
{ |
||||
get |
||||
{ |
||||
return ((APIsEnums.ListViewItemStates)uOldState & APIsEnums.ListViewItemStates.SELECTED) == APIsEnums.ListViewItemStates.SELECTED; |
||||
} |
||||
} |
||||
public bool NewCheck |
||||
{ |
||||
get |
||||
{ |
||||
try |
||||
{ |
||||
return uNewState >= 0x1000 ? ((uNewState & (uint)APIsEnums.ListViewItemStates.STATEIMAGEMASK) >> 12) - 1 > 0 : false; |
||||
} |
||||
catch |
||||
{ |
||||
return false; |
||||
} |
||||
} |
||||
} |
||||
public bool OldCheck |
||||
{ |
||||
get |
||||
{ |
||||
try |
||||
{ |
||||
return uOldState >= 0x1000 ? ((uOldState & (uint)APIsEnums.ListViewItemStates.STATEIMAGEMASK) >> 12) - 1 > 0 : false; |
||||
} |
||||
catch |
||||
{ |
||||
return false; |
||||
} |
||||
} |
||||
} |
||||
public bool NewFocused |
||||
{ |
||||
get |
||||
{ |
||||
return ((APIsEnums.ListViewItemStates)uNewState & APIsEnums.ListViewItemStates.FOCUSED) == APIsEnums.ListViewItemStates.FOCUSED; |
||||
} |
||||
} |
||||
public bool OldFocused |
||||
{ |
||||
get |
||||
{ |
||||
return ((APIsEnums.ListViewItemStates)uOldState & APIsEnums.ListViewItemStates.FOCUSED) == APIsEnums.ListViewItemStates.FOCUSED; |
||||
} |
||||
} |
||||
public bool Select |
||||
{ |
||||
get |
||||
{ |
||||
return !OldSelected && NewSelected; |
||||
} |
||||
} |
||||
public bool UnSelect |
||||
{ |
||||
get |
||||
{ |
||||
return OldSelected && !NewSelected; |
||||
} |
||||
} |
||||
public bool Focus |
||||
{ |
||||
get |
||||
{ |
||||
return !OldFocused && NewFocused; |
||||
} |
||||
} |
||||
public bool UnFocus |
||||
{ |
||||
get |
||||
{ |
||||
return OldFocused && !NewFocused; |
||||
} |
||||
} |
||||
public bool Check |
||||
{ |
||||
get |
||||
{ |
||||
return !OldCheck && NewCheck; |
||||
} |
||||
} |
||||
public bool UnCheck |
||||
{ |
||||
get |
||||
{ |
||||
return OldCheck && !NewCheck; |
||||
} |
||||
} |
||||
} |
||||
#endregion
|
||||
#region HDITEM
|
||||
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)] |
||||
public struct HDITEM |
||||
{ |
||||
public APIsEnums.HeaderItemFlags mask; |
||||
public int cxy; |
||||
public IntPtr pszText; |
||||
public IntPtr hbm; |
||||
public int cchTextMax; |
||||
public int fmt; |
||||
public int lParam; |
||||
public int iImage; |
||||
public int iOrder; |
||||
} |
||||
#endregion
|
||||
#region HD_HITTESTINFO
|
||||
[StructLayout(LayoutKind.Sequential)] |
||||
public struct HD_HITTESTINFO |
||||
{ |
||||
public POINTAPI pt; |
||||
public APIsEnums.HeaderControlHitTestFlags flags; |
||||
public int iItem; |
||||
} |
||||
#endregion
|
||||
|
||||
#region POINTAPI
|
||||
[StructLayoutAttribute(LayoutKind.Sequential)] |
||||
public struct POINTAPI |
||||
{ |
||||
public POINTAPI(System.Drawing.Point p) {x = p.X; y = p.Y;} |
||||
public POINTAPI(Int32 X, Int32 Y) {x = X; y = Y;} |
||||
public Int32 x; |
||||
public Int32 y; |
||||
} |
||||
#endregion
|
||||
#region RECT
|
||||
[StructLayout(LayoutKind.Sequential)] |
||||
public struct RECT |
||||
{ |
||||
public RECT(Drawing.Rectangle rectangle) |
||||
{ left = rectangle.Left; top = rectangle.Top; |
||||
right = rectangle.Right; bottom = rectangle.Bottom;} |
||||
public int left; |
||||
public int top; |
||||
public int right; |
||||
public int bottom; |
||||
} |
||||
#endregion
|
||||
#region SIZE
|
||||
[StructLayout(LayoutKind.Sequential)] |
||||
public struct SIZE |
||||
{ |
||||
public int cx; |
||||
public int cy; |
||||
} |
||||
#endregion
|
||||
|
||||
#region NMHDR
|
||||
// [StructLayout(LayoutKind.Sequential)]
|
||||
public struct NMHDR |
||||
{ |
||||
public IntPtr hwndFrom; |
||||
public int idFrom; |
||||
public int code; |
||||
} |
||||
#endregion
|
||||
#region NMCUSTOMDRAW
|
||||
[StructLayout(LayoutKind.Sequential)] |
||||
public struct NMCUSTOMDRAW |
||||
{ |
||||
public NMHDR hdr; |
||||
public int dwDrawStage; |
||||
public IntPtr hdc; |
||||
public RECT rc; |
||||
public uint dwItemSpec; |
||||
public uint uItemState; |
||||
public IntPtr lItemlParam; |
||||
} |
||||
#endregion
|
||||
#region NMLVCUSTOMDRAW
|
||||
[StructLayout(LayoutKind.Sequential)] |
||||
public struct NMLVCUSTOMDRAW |
||||
{ |
||||
public NMCUSTOMDRAW nmcd; |
||||
public int clrText; |
||||
public int clrTextBk; |
||||
public int iSubItem; |
||||
public int dwItemType; |
||||
public int clrFace; |
||||
public int iIconEffect; |
||||
public int iIconPhase; |
||||
public int iPartId; |
||||
public int iStateId; |
||||
public RECT rcText; |
||||
public uint uAlign; |
||||
} |
||||
#endregion
|
||||
#region NMTVCUSTOMDRAW
|
||||
[StructLayout(LayoutKind.Sequential)] |
||||
public struct NMTVCUSTOMDRAW |
||||
{ |
||||
public NMCUSTOMDRAW nmcd; |
||||
public uint clrText; |
||||
public uint clrTextBk; |
||||
public int iLevel; |
||||
} |
||||
#endregion
|
||||
|
||||
#region BITMAPINFO_FLAT
|
||||
[StructLayout(LayoutKind.Sequential)] |
||||
public struct BITMAPINFO_FLAT |
||||
{ |
||||
public int bmiHeader_biSize; |
||||
public int bmiHeader_biWidth; |
||||
public int bmiHeader_biHeight; |
||||
public short bmiHeader_biPlanes; |
||||
public short bmiHeader_biBitCount; |
||||
public int bmiHeader_biCompression; |
||||
public int bmiHeader_biSizeImage; |
||||
public int bmiHeader_biXPelsPerMeter; |
||||
public int bmiHeader_biYPelsPerMeter; |
||||
public int bmiHeader_biClrUsed; |
||||
public int bmiHeader_biClrImportant; |
||||
[MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst=1024)] |
||||
public byte[] bmiColors; |
||||
} |
||||
#endregion
|
||||
#region BITMAPINFOHEADER
|
||||
[StructLayout(LayoutKind.Sequential)] |
||||
public class BITMAPINFOHEADER |
||||
{ |
||||
public int biSize = Marshal.SizeOf(typeof(BITMAPINFOHEADER)); |
||||
public int biWidth; |
||||
public int biHeight; |
||||
public short biPlanes; |
||||
public short biBitCount; |
||||
public int biCompression; |
||||
public int biSizeImage; |
||||
public int biXPelsPerMeter; |
||||
public int biYPelsPerMeter; |
||||
public int biClrUsed; |
||||
public int biClrImportant; |
||||
} |
||||
#endregion
|
||||
|
||||
#region MSG
|
||||
[StructLayout(LayoutKind.Sequential)] |
||||
public struct MSG |
||||
{ |
||||
public IntPtr hwnd; |
||||
public int message; |
||||
public IntPtr wParam; |
||||
public IntPtr lParam; |
||||
public int time; |
||||
public int pt_x; |
||||
public int pt_y; |
||||
} |
||||
#endregion
|
||||
#region PAINTSTRUCT
|
||||
[StructLayout(LayoutKind.Sequential)] |
||||
public struct PAINTSTRUCT |
||||
{ |
||||
public IntPtr hdc; |
||||
public int fErase; |
||||
public System.Drawing.Rectangle rcPaint; |
||||
public int fRestore; |
||||
public int fIncUpdate; |
||||
public int Reserved1; |
||||
public int Reserved2; |
||||
public int Reserved3; |
||||
public int Reserved4; |
||||
public int Reserved5; |
||||
public int Reserved6; |
||||
public int Reserved7; |
||||
public int Reserved8; |
||||
} |
||||
#endregion
|
||||
#region TRACKMOUSEEVENTS
|
||||
[StructLayout(LayoutKind.Sequential)] |
||||
public struct TRACKMOUSEEVENTS |
||||
{ |
||||
public uint cbSize; |
||||
public APIsEnums.TrackerEventFlags dwFlags; |
||||
public IntPtr hWnd; |
||||
public uint dwHoverTime; |
||||
} |
||||
#endregion
|
||||
#region WINDOWPLACEMENT
|
||||
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)] |
||||
public struct WINDOWPLACEMENT |
||||
{ |
||||
public uint length; |
||||
public uint flags; |
||||
public uint showCmd; |
||||
public APIsStructs.POINTAPI ptMinPosition; |
||||
public APIsStructs.POINTAPI ptMaxPosition; |
||||
public APIsStructs.RECT rcNormalPosition; |
||||
} |
||||
#endregion
|
||||
|
||||
#region SCROLLINFO
|
||||
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)] |
||||
public struct SCROLLINFO |
||||
{ |
||||
public uint cbSize; |
||||
public uint fMask; |
||||
public int nMin; |
||||
public int nMax; |
||||
public uint nPage; |
||||
public int nPos; |
||||
public int nTrackPos; |
||||
} |
||||
#endregion
|
||||
#region SCROLLBARINFO
|
||||
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)] |
||||
public struct SCROLLBARINFO |
||||
{ |
||||
public uint cbSize; |
||||
public APIsStructs.RECT rcScrollBar; |
||||
public int dxyLineButton; |
||||
public int xyThumbTop; |
||||
public int xyThumbBottom; |
||||
public int reserved; |
||||
[MarshalAs(System.Runtime.InteropServices.UnmanagedType.ByValArray, SizeConst=6)] |
||||
public uint[] rgstate; |
||||
} |
||||
#endregion
|
||||
|
||||
#region PCOMBOBOXINFO
|
||||
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)] |
||||
public struct PCOMBOBOXINFO |
||||
{ |
||||
public uint cbSize; |
||||
public APIsStructs.RECT rcItem; |
||||
public APIsStructs.RECT rcButton; |
||||
public int stateButton; |
||||
public IntPtr hwndCombo; |
||||
public IntPtr hwndItem; |
||||
public IntPtr hwndList; |
||||
} |
||||
#endregion
|
||||
|
||||
#region BLENDFUNCTION
|
||||
[StructLayout(LayoutKind.Sequential, Pack=1)] |
||||
public struct BLENDFUNCTION |
||||
{ |
||||
public byte BlendOp; |
||||
public byte BlendFlags; |
||||
public byte SourceConstantAlpha; |
||||
public byte AlphaFormat; |
||||
} |
||||
#endregion
|
||||
|
||||
#region NMHEADER
|
||||
[StructLayout(LayoutKind.Sequential, Pack=1)] |
||||
public struct NMHEADER |
||||
{ |
||||
public NMHDR nmhdr; |
||||
public int iItem; |
||||
public int iButton; |
||||
public HDITEM pItem; |
||||
} |
||||
#endregion
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack=1)] |
||||
public struct INPUT |
||||
{ |
||||
public uint type; |
||||
public int dx; |
||||
public int dy; |
||||
public uint mouseData; |
||||
public uint dwFlags; |
||||
public uint time; |
||||
public uint dwExtra; |
||||
} |
||||
} |
||||
} |
@ -1,181 +0,0 @@
@@ -1,181 +0,0 @@
|
||||
using System; |
||||
|
||||
namespace System.Runtime.InteropServices.APIs |
||||
{ |
||||
public class APIsUser32 |
||||
{ |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
static public extern uint SendInput(uint nInputs, APIsStructs.INPUT[] inputs, int cbSize); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
static public extern bool ScreenToClient(IntPtr hWnd, ref APIsStructs.POINTAPI point); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
static public extern int DrawFrameControl(IntPtr hDc, APIsStructs.RECT rect, APIsEnums.DrawFrameControlFlags nType, APIsEnums.DrawFrameControlStateFlags nState); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
static public extern int GetSysColor(APIsEnums.SystemColors nIndex); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
static public extern bool DestroyIcon(IntPtr hIcon); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
static public extern bool GetComboBoxInfo(IntPtr hWnd, ref APIsStructs.PCOMBOBOXINFO cbi); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
static public extern bool DestroyWindow(IntPtr hWnd); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
static public extern IntPtr GetDC(IntPtr hWnd); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
static public extern int ReleaseDC(IntPtr hWnd, IntPtr hDC); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
static public extern IntPtr GetDesktopWindow(); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
static public extern bool ShowWindow(IntPtr hWnd, APIsEnums.ShowWindowStyles State); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
static public extern bool UpdateWindow(IntPtr hWnd); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
static public extern bool SetForegroundWindow(IntPtr hWnd); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
static public extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int Width, int Height, uint flags); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
static public extern bool OpenClipboard(IntPtr hWndNewOwner); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
static public extern bool CloseClipboard(); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
static public extern bool EmptyClipboard(); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
static public extern IntPtr SetClipboardData( uint Format, IntPtr hData); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
static public extern bool GetMenuItemRect(IntPtr hWnd, IntPtr hMenu, uint Item, ref APIsStructs.RECT rc); |
||||
[DllImport("user32.dll", ExactSpelling=true, CharSet=CharSet.Auto)] |
||||
public static extern IntPtr GetParent(IntPtr hWnd); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
public static extern int SendMessage(IntPtr hWnd, APIsEnums.HeaderControlMessages msg, int wParam, ref APIsStructs.HDITEM lParam); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
public static extern int SendMessage(IntPtr hWnd, int msg, int wParam, int lParam); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
public static extern int SendMessage(IntPtr hWnd, APIsEnums.HeaderControlMessages msg, IntPtr wParam, ref APIsStructs.HD_HITTESTINFO hd_hittestinfo); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
public static extern int SendMessage(IntPtr hWnd, APIsEnums.WindowMessages msg, int wParam, int lParam); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
public static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wParam, IntPtr lParam); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
public static extern void SendMessage(IntPtr hWnd, int msg, IntPtr wParam, ref APIsStructs.NMHDR lParam); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
public static extern void SendMessage(IntPtr hWnd, int msg, IntPtr wParam, ref APIsStructs.NMLVDISPINFO lParam); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
public static extern void SendMessage(IntPtr hWnd, int msg, int wParam, ref APIsStructs.RECT lParam); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
public static extern int SendMessage(IntPtr hWnd, int msg, int wParam, ref APIsStructs.POINTAPI lParam); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
public static extern IntPtr PostMessage(IntPtr hWnd, int msg, int wParam, int lParam); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
public static extern IntPtr PostMessage(IntPtr hWnd, APIsEnums.WindowMessages msg, int wParam, int lParam); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
public static extern IntPtr SetFocus(IntPtr hWnd); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
public extern static int DrawText(IntPtr hdc, string lpString, int nCount, ref APIsStructs.RECT lpRect, APIsEnums.DrawTextFormatFlags flags); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
public extern static IntPtr SetParent(IntPtr hChild, IntPtr hParent); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
public extern static IntPtr GetDlgItem(IntPtr hDlg, int nControlID); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
public extern static int GetClientRect(IntPtr hWnd, ref APIsStructs.RECT rc); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
public extern static int InvalidateRect(IntPtr hWnd, ref APIsStructs.RECT rc, int bErase); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
public extern static int InvalidateRect(IntPtr hWnd, IntPtr rc, int bErase); |
||||
[DllImport("User32.dll", CharSet=CharSet.Auto)] |
||||
public static extern bool WaitMessage(); |
||||
[DllImport("User32.dll", CharSet=CharSet.Auto)] |
||||
public static extern bool PeekMessage(ref APIsStructs.MSG msg, int hWnd, uint wFilterMin, uint wFilterMax, APIsEnums.PeekMessageFlags flags); |
||||
[DllImport("User32.dll", CharSet=CharSet.Auto)] |
||||
public static extern bool GetMessage(ref APIsStructs.MSG msg, int hWnd, uint wFilterMin, uint wFilterMax); |
||||
[DllImport("User32.dll", CharSet=CharSet.Auto)] |
||||
public static extern bool TranslateMessage(ref APIsStructs.MSG msg); |
||||
[DllImport("User32.dll", CharSet=CharSet.Auto)] |
||||
public static extern bool DispatchMessage(ref APIsStructs.MSG msg); |
||||
[DllImport("User32.dll", CharSet=CharSet.Auto)] |
||||
public static extern IntPtr LoadCursor(IntPtr hInstance, APIsEnums.CursorTypes cursor); |
||||
[DllImport("User32.dll", CharSet=CharSet.Auto)] |
||||
public static extern IntPtr SetCursor(IntPtr hCursor); |
||||
[DllImport("User32.dll", CharSet=CharSet.Auto)] |
||||
public static extern IntPtr GetFocus(); |
||||
[DllImport("User32.dll", CharSet=CharSet.Auto)] |
||||
public static extern bool ReleaseCapture(); |
||||
[DllImport("User32.dll", CharSet=CharSet.Auto)] |
||||
public static extern IntPtr SetCapture(IntPtr hWnd); |
||||
[DllImport("User32.dll", CharSet=CharSet.Auto)] |
||||
public static extern IntPtr BeginPaint(IntPtr hWnd, ref APIsStructs.PAINTSTRUCT ps); |
||||
[DllImport("User32.dll", CharSet=CharSet.Auto)] |
||||
public static extern bool EndPaint(IntPtr hWnd, ref APIsStructs.PAINTSTRUCT ps); |
||||
[DllImport("User32.dll", CharSet=CharSet.Auto)] |
||||
public static extern bool UpdateLayeredWindow(IntPtr hwnd, IntPtr hdcDst, ref APIsStructs.POINTAPI pptDst, ref APIsStructs.SIZE psize, |
||||
IntPtr hdcSrc, ref APIsStructs.POINTAPI pprSrc, Int32 crKey, ref APIsStructs.BLENDFUNCTION pblend, APIsEnums.UpdateLayeredWindowFlags dwFlags); |
||||
[DllImport("User32.dll", CharSet=CharSet.Auto)] |
||||
public static extern bool GetWindowRect(IntPtr hWnd, ref APIsStructs.RECT rect); |
||||
[DllImport("User32.dll", CharSet=CharSet.Auto)] |
||||
public static extern bool ClientToScreen(IntPtr hWnd, ref APIsStructs.POINTAPI pt); |
||||
[DllImport("User32.dll", CharSet=CharSet.Auto)] |
||||
public static extern bool TrackMouseEvent(ref APIsStructs.TRACKMOUSEEVENTS tme); |
||||
[DllImport("User32.dll", CharSet=CharSet.Auto)] |
||||
public static extern bool SetWindowRgn(IntPtr hWnd, IntPtr hRgn, bool redraw); |
||||
[DllImport("User32.dll", CharSet=CharSet.Auto)] |
||||
public static extern ushort GetKeyState(int virtKey); |
||||
[DllImport("User32.dll", CharSet=CharSet.Auto)] |
||||
public static extern bool MoveWindow(IntPtr hWnd, int x, int y, int width, int height, bool repaint); |
||||
[DllImport("User32.dll", CharSet=CharSet.Auto)] |
||||
public static extern int GetClassName(IntPtr hWnd, System.Text.StringBuilder ClassName, int nMaxCount); |
||||
[DllImport("User32.dll", CharSet=CharSet.Auto)] |
||||
public static extern IntPtr GetDCEx(IntPtr hWnd, IntPtr hRegion, uint flags); |
||||
[DllImport("User32.dll", CharSet=CharSet.Auto)] |
||||
public static extern IntPtr GetWindowDC(IntPtr hWnd); |
||||
[DllImport("User32.dll", CharSet=CharSet.Auto)] |
||||
public static extern int FillRect(IntPtr hDC, ref APIsStructs.RECT rect, IntPtr hBrush); |
||||
[DllImport("User32.dll", CharSet=CharSet.Auto)] |
||||
public static extern int GetWindowPlacement(IntPtr hWnd, ref APIsStructs.WINDOWPLACEMENT wp); |
||||
[DllImport("User32.dll", CharSet=CharSet.Auto)] |
||||
public static extern int SetWindowText(IntPtr hWnd, string text); |
||||
[DllImport("User32.dll", CharSet=CharSet.Auto)] |
||||
public static extern int GetWindowText(IntPtr hWnd, System.Text.StringBuilder text, int maxCount); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
static public extern int SendMessage(IntPtr hWnd, int Msg, IntPtr wParam, IntPtr lParam); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
static public extern IntPtr SetClipboardViewer(IntPtr hWndNewViewer); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
static public extern int ChangeClipboardChain(IntPtr hWndRemove, IntPtr hWndNewNext); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
static public extern int GetSystemMetrics(APIsEnums.SystemMetricsCodes code); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
static public extern int SetScrollInfo(IntPtr hwnd, int bar, ref APIsStructs.SCROLLINFO si, int fRedraw); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
static public extern int ShowScrollBar(IntPtr hWnd, int bar, int show); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
static public extern int EnableScrollBar(IntPtr hWnd, uint flags, uint arrows); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
static public extern int BringWindowToTop(IntPtr hWnd); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
static public extern int GetScrollInfo(IntPtr hwnd, int bar, ref APIsStructs.SCROLLINFO si); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
static public extern int ScrollWindowEx(IntPtr hWnd, int dx, int dy, |
||||
ref APIsStructs.RECT rcScroll, ref APIsStructs.RECT rcClip, IntPtr UpdateRegion, ref APIsStructs.RECT rcInvalidated, uint flags); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
static public extern bool IsWindow(IntPtr hWnd); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
static public extern int LockWindowUpdate(IntPtr hWnd); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
static public extern bool ValidateRect(IntPtr hWnd, ref APIsStructs.RECT rcInvalidated); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
static public extern bool ValidateRect(IntPtr hWnd, IntPtr rc); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
static public extern int GetScrollBarInfo(IntPtr hWnd, APIsEnums.SystemObjects id, ref APIsStructs.SCROLLBARINFO sbi); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
static public extern int SetProp(IntPtr hWnd, IntPtr atom, IntPtr hData); |
||||
[DllImport("user32.dll", CharSet=CharSet.Auto)] |
||||
static public extern int CallWindowProc(IntPtr hOldProc, IntPtr hWnd, uint message, int wParam, int lParam); |
||||
[DllImport("user32.dll")] |
||||
public static extern bool SendMessage(IntPtr hWnd, APIsEnums.ListViewMessages msg, |
||||
Int32 wParam, ref APIsStructs.LV_ITEM lParam); |
||||
[DllImport("user32.dll")] |
||||
public static extern int SendMessage(IntPtr hWnd, Int32 msg, Int32 wParam, ref |
||||
APIsStructs.LVHITTESTINFO lParam); |
||||
[DllImport("user32.dll")] |
||||
public static extern bool SendMessage(IntPtr hWnd, int msg, |
||||
IntPtr wParam, ref IntPtr lParam); |
||||
} |
||||
} |
@ -1,26 +0,0 @@
@@ -1,26 +0,0 @@
|
||||
using System; |
||||
|
||||
namespace System.Runtime.InteropServices.APIs |
||||
{ |
||||
public class APIsUxTheme |
||||
{ |
||||
[DllImport("UxTheme.dll", CharSet=CharSet.Auto)] |
||||
static public extern IntPtr OpenThemeData( |
||||
IntPtr hWnd, string pszClassList); |
||||
[DllImport("UxTheme.dll", CharSet=CharSet.Auto)] |
||||
static public extern int CloseThemeData(IntPtr hTheme); |
||||
[DllImport("UxTheme.dll", CharSet=CharSet.Auto)] |
||||
static public extern bool IsThemeActive(); |
||||
[DllImport("UxTheme.dll", CharSet=CharSet.Auto)] |
||||
static public extern bool IsAppThemed(); |
||||
[DllImport("UxTheme.dll", CharSet=CharSet.Auto)] |
||||
static public extern int DrawThemeBackground( |
||||
IntPtr hWnd, IntPtr hDc, int iPartId, int iStateId, |
||||
APIsStructs.RECT pRect, APIsStructs.RECT pClipRect); |
||||
[DllImport("UxTheme.dll", CharSet=CharSet.Auto)] |
||||
static public extern int GetCurrentThemeName( |
||||
Text.StringBuilder pszThemeFileName, int dwMaxNameChars, |
||||
Text.StringBuilder pszColorBuff, int cchMaxColorChars, |
||||
Text.StringBuilder pszSizeBuff, int cchMaxSizeChars); |
||||
} |
||||
} |
@ -1,48 +0,0 @@
@@ -1,48 +0,0 @@
|
||||
using System; |
||||
|
||||
namespace System.Runtime.InteropServices.APIs |
||||
{ |
||||
public class APIsWndProc |
||||
{ |
||||
[DllImport("user32.dll")] |
||||
public static extern IntPtr SetWindowLong( |
||||
IntPtr window, |
||||
int index, |
||||
WndProc value); |
||||
|
||||
[DllImport("user32.dll")] |
||||
public static extern IntPtr SetWindowLong( |
||||
IntPtr window, |
||||
int index, |
||||
GetWndProc value); |
||||
|
||||
[DllImport("user32.dll")] |
||||
public static extern IntPtr SetWindowLong( |
||||
IntPtr window, |
||||
int index, |
||||
IntPtr value); |
||||
|
||||
[DllImport("user32.dll")] |
||||
public static extern int GetWindowLong( |
||||
IntPtr window, |
||||
int index); |
||||
|
||||
[DllImport("user32.dll")] |
||||
public static extern int CallWindowProc( |
||||
IntPtr value, |
||||
IntPtr Handle, |
||||
int Msg, |
||||
IntPtr WParam, |
||||
IntPtr LParam); |
||||
|
||||
[DllImport("user32.dll")] |
||||
public static extern int DefWindowProc( |
||||
IntPtr Handle, |
||||
int Msg, |
||||
IntPtr WParam, |
||||
IntPtr LParam); |
||||
|
||||
public delegate int GetWndProc(IntPtr hWnd, int Msg, IntPtr WParam, IntPtr LParam); |
||||
public delegate void WndProc(ref System.Windows.Forms.Message m); |
||||
} |
||||
} |
@ -1,166 +0,0 @@
@@ -1,166 +0,0 @@
|
||||
using System; |
||||
using System.Text; |
||||
|
||||
namespace System.Runtime.InteropServices.APIs |
||||
{ |
||||
public class COMInterfaces |
||||
{ |
||||
#region IShellFolder
|
||||
[ComImport, |
||||
Guid("000214E6-0000-0000-C000-000000000046"), |
||||
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] |
||||
public interface IShellFolder |
||||
{ |
||||
void ParseDisplayName( |
||||
IntPtr hwnd, |
||||
IntPtr pbc, |
||||
[MarshalAs(UnmanagedType.LPWStr)] string pszDisplayName, |
||||
out uint pchEaten, |
||||
out IntPtr ppidl, |
||||
ref uint pdwAttributes); |
||||
|
||||
[PreserveSig] |
||||
int EnumObjects(IntPtr hWnd, APIsEnums.ShellFolderEnumObjectsTypes flags, ref IEnumIDList enumList); |
||||
|
||||
void BindToObject( |
||||
IntPtr pidl, |
||||
IntPtr pbc, |
||||
[In()] ref Guid riid, |
||||
out IShellFolder ppv); |
||||
//[MarshalAs(UnmanagedType.Interface)] out object ppv);
|
||||
|
||||
void BindToStorage( |
||||
IntPtr pidl, |
||||
IntPtr pbc, |
||||
[In()] ref Guid riid, |
||||
[MarshalAs(UnmanagedType.Interface)] out object ppv); |
||||
|
||||
[PreserveSig()] |
||||
uint CompareIDs( |
||||
int lParam, |
||||
IntPtr pidl1, |
||||
IntPtr pidl2); |
||||
|
||||
void CreateViewObject( |
||||
IntPtr hwndOwner, |
||||
[In()] ref Guid riid, |
||||
[MarshalAs(UnmanagedType.Interface)] out object ppv); |
||||
|
||||
void GetAttributesOf( |
||||
uint cidl, |
||||
[In(), MarshalAs(UnmanagedType.LPArray)] IntPtr[] apidl, |
||||
ref APIsEnums.ShellFolderAttributes rgfInOut); |
||||
|
||||
[return: MarshalAs(UnmanagedType.Interface)] |
||||
object GetUIObjectOf( |
||||
IntPtr hwndOwner, |
||||
uint cidl, |
||||
[MarshalAs(UnmanagedType.LPArray)] IntPtr[] apidl, |
||||
[In()] ref Guid riid, |
||||
IntPtr rgfReserved); |
||||
|
||||
void GetDisplayNameOf( |
||||
IntPtr pidl, |
||||
APIsEnums.ShellFolderDisplayNames uFlags, |
||||
out APIsStructs.STRRET pName); |
||||
|
||||
IntPtr SetNameOf( |
||||
IntPtr hwnd, |
||||
IntPtr pidl, |
||||
[MarshalAs(UnmanagedType.LPWStr)] string pszName, |
||||
APIsEnums.ShellFolderDisplayNames uFlags); |
||||
} |
||||
#endregion
|
||||
#region IEnumIDList
|
||||
[ComImport(), |
||||
Guid("000214F2-0000-0000-C000-000000000046"), |
||||
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] |
||||
public interface IEnumIDList |
||||
{ |
||||
[PreserveSig()] |
||||
uint Next( |
||||
uint celt, |
||||
[In(), Out(), MarshalAs(UnmanagedType.LPArray)] IntPtr[] rgelt, |
||||
out uint pceltFetched); |
||||
|
||||
void Skip( |
||||
uint celt); |
||||
|
||||
void Reset(); |
||||
|
||||
IEnumIDList Clone(); |
||||
} |
||||
#endregion
|
||||
#region IDataObject
|
||||
[ComImport(), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), GuidAttribute("0000010e-0000-0000-C000-000000000046")] |
||||
public interface IDataObject |
||||
{ |
||||
[PreserveSig()] |
||||
int GetData(ref APIsStructs.FORMATETC a, ref APIsStructs.STGMEDIUM b); |
||||
[PreserveSig()] |
||||
void GetDataHere(int a, ref APIsStructs.STGMEDIUM b); |
||||
[PreserveSig()] |
||||
int QueryGetData(int a); |
||||
[PreserveSig()] |
||||
int GetCanonicalFormatEtc(int a, ref int b); |
||||
[PreserveSig()] |
||||
int SetData(int a, int b, int c); |
||||
[PreserveSig()] |
||||
int EnumFormatEtc(uint a, ref Object b); |
||||
[PreserveSig()] |
||||
int DAdvise(int a, uint b, Object c, ref uint d); |
||||
[PreserveSig()] |
||||
int DUnadvise(uint a); |
||||
[PreserveSig()] |
||||
int EnumDAdvise(ref Object a); |
||||
} |
||||
#endregion
|
||||
#region IShellExtInit
|
||||
[ComImport(), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), GuidAttribute("000214e8-0000-0000-c000-000000000046")] |
||||
public interface IShellExtInit |
||||
{ |
||||
[PreserveSig()] |
||||
int Initialize (IntPtr pidlFolder, IntPtr lpdobj, uint /*HKEY*/ hKeyProgID); |
||||
} |
||||
#endregion
|
||||
|
||||
#region IContextMenu
|
||||
[ComImport(), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), GuidAttribute("000214e4-0000-0000-c000-000000000046")] |
||||
public interface IContextMenu |
||||
{ |
||||
// IContextMenu methods
|
||||
[PreserveSig()] |
||||
int QueryContextMenu(uint hmenu, uint iMenu, int idCmdFirst, int idCmdLast, uint uFlags); |
||||
[PreserveSig()] |
||||
void InvokeCommand (ref APIsStructs.CMINVOKECOMMANDINFO pici); |
||||
[PreserveSig()] |
||||
void GetCommandString( |
||||
int idcmd, |
||||
APIsEnums.GetCommandStringInformations uflags, |
||||
int reserved, |
||||
StringBuilder commandstring, |
||||
int cch); |
||||
} |
||||
#endregion
|
||||
#region IContextMenu2
|
||||
[ComImport(), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), GuidAttribute("000214f4-0000-0000-c000-000000000046")] |
||||
public interface IContextMenu2 |
||||
{ |
||||
// IContextMenu methods
|
||||
[PreserveSig()] |
||||
int QueryContextMenu(uint hmenu, uint iMenu, int idCmdFirst, int idCmdLast, uint uFlags); |
||||
[PreserveSig()] |
||||
void InvokeCommand (ref APIsStructs.CMINVOKECOMMANDINFO pici); |
||||
[PreserveSig()] |
||||
void GetCommandString(int idcmd, |
||||
APIsEnums.GetCommandStringInformations uflags, |
||||
int reserved, |
||||
StringBuilder commandstring, |
||||
int cch); |
||||
// IContextMenu2 methods
|
||||
[PreserveSig()] |
||||
uint HandleMenuMsg(uint uMsg,IntPtr wParam,IntPtr lParam); |
||||
} |
||||
#endregion
|
||||
} |
||||
} |
@ -1,559 +0,0 @@
@@ -1,559 +0,0 @@
|
||||
using System; |
||||
using System.Drawing; |
||||
|
||||
namespace System.Runtime.InteropServices.APIs |
||||
{ |
||||
/// <summary>
|
||||
/// Summary description for ColorConvert.
|
||||
/// </summary>
|
||||
public class ColorUtil |
||||
{ |
||||
|
||||
#region Class Variables
|
||||
static Color backgroundColor = Color.Empty; |
||||
static Color selectionColor = Color.Empty; |
||||
static Color selectionUnfocusedColor = Color.Empty; |
||||
static Color controlColor = Color.Empty; |
||||
static Color pressedColor = Color.Empty; |
||||
static Color checkedColor = Color.Empty; |
||||
static Color borderColor = Color.Empty; |
||||
static bool useCustomColor = false; |
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
// No need to construct this object
|
||||
private ColorUtil() |
||||
{ |
||||
} |
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
static public bool UsingCustomColor |
||||
{ |
||||
get { return useCustomColor;} |
||||
} |
||||
#endregion
|
||||
|
||||
#region Knowncolor names
|
||||
static public string[] KnownColorNames = |
||||
{ "Transparent", "Black", "DimGray", "Gray", "DarkGray", "Silver", "LightGray", "Gainsboro", "WhiteSmoke", "White", |
||||
"RosyBrown", "IndianRed", "Brown", "Firebrick", "LightCoral", "Maroon", "DarkRed", "Red", "Snow", "MistyRose", |
||||
"Salmon", "Tomato", "DarkSalmon", "Coral", "OrangeRed", "LightSalmon", "Sienna", "SeaShell", "Chocalate", |
||||
"SaddleBrown", "SandyBrown", "PeachPuff", "Peru", "Linen", "Bisque", "DarkOrange", "BurlyWood", "Tan", "AntiqueWhite", |
||||
"NavajoWhite", "BlanchedAlmond", "PapayaWhip", "Mocassin", "Orange", "Wheat", "OldLace", "FloralWhite", "DarkGoldenrod", |
||||
"Cornsilk", "Gold", "Khaki", "LemonChiffon", "PaleGoldenrod", "DarkKhaki", "Beige", "LightGoldenrod", "Olive", |
||||
"Yellow", "LightYellow", "Ivory", "OliveDrab", "YellowGreen", "DarkOliveGreen", "GreenYellow", "Chartreuse", "LawnGreen", |
||||
"DarkSeaGreen", "ForestGreen", "LimeGreen", "PaleGreen", "DarkGreen", "Green", "Lime", "Honeydew", "SeaGreen", "MediumSeaGreen", |
||||
"SpringGreen", "MintCream", "MediumSpringGreen", "MediumAquaMarine", "YellowAquaMarine", "Turquoise", "LightSeaGreen", |
||||
"MediumTurquoise", "DarkSlateGray", "PaleTurquoise", "Teal", "DarkCyan", "Aqua", "Cyan", "LightCyan", "Azure", "DarkTurquoise", |
||||
"CadetBlue", "PowderBlue", "LightBlue", "DeepSkyBlue", "SkyBlue", "LightSkyBlue", "SteelBlue", "AliceBlue", "DodgerBlue", |
||||
"SlateGray", "LightSlateGray", "LightSteelBlue", "CornflowerBlue", "RoyalBlue", "MidnightBlue", "Lavender", "Navy", |
||||
"DarkBlue", "MediumBlue", "Blue", "GhostWhite", "SlateBlue", "DarkSlateBlue", "MediumSlateBlue", "MediumPurple", |
||||
"BlueViolet", "Indigo", "DarkOrchid", "DarkViolet", "MediumOrchid", "Thistle", "Plum", "Violet", "Purple", "DarkMagenta", |
||||
"Magenta", "Fuchsia", "Orchid", "MediumVioletRed", "DeepPink", "HotPink", "LavenderBlush", "PaleVioletRed", "Crimson", |
||||
"Pink", "LightPink" }; |
||||
#endregion
|
||||
|
||||
#region Systemcolors names
|
||||
static public string[] SystemColorNames = |
||||
{ |
||||
"ActiveBorder", "ActiveCaption", "ActiveCaptionText", "AppWorkspace", "Control", "ControlDark", "ControlDarkDark", |
||||
"ControlLight", "ControlLightLight", "ControlText", "Desktop", "GrayText", "HighLight", "HighLightText", |
||||
"HotTrack", "InactiveBorder", "InactiveCaption", "InactiveCaptionText", "Info", "InfoText", "Menu", "MenuText", |
||||
"ScrollBar", "Window", "WindowFrame", "WindowText" }; |
||||
#endregion
|
||||
|
||||
#region Conversion between RGB and Hue, Saturation and Luminosity function helpers
|
||||
static public void HSLToRGB(float h, float s, float l, ref float r, ref float g, ref float b) |
||||
{ |
||||
// given h,s,l,[240 and r,g,b [0-255]
|
||||
// convert h [0-360], s,l,r,g,b [0-1]
|
||||
h=(h/240)*360; |
||||
s /= 240; |
||||
l /= 240; |
||||
r /= 255; |
||||
g /= 255; |
||||
b /= 255; |
||||
|
||||
// Begin Foley
|
||||
float m1,m2; |
||||
|
||||
// Calc m2
|
||||
if (l<=0.5f) |
||||
{ |
||||
//m2=(l*(l+s)); seems to be typo in Foley??, replace l for 1
|
||||
m2=(l*(1+s)); |
||||
} |
||||
else |
||||
{ |
||||
m2=(l+s-l*s); |
||||
} |
||||
|
||||
//calc m1
|
||||
m1=2.0f*l-m2; |
||||
|
||||
//calc r,g,b in [0-1]
|
||||
if (s==0.0f) |
||||
{ // Achromatic: There is no hue
|
||||
// leave out the UNDEFINED part, h will always have value
|
||||
r=g=b=l; |
||||
} |
||||
else |
||||
{ // Chromatic: There is a hue
|
||||
r= getRGBValue(m1,m2,h+120.0f); |
||||
g= getRGBValue(m1,m2,h); |
||||
b= getRGBValue(m1,m2,h-120.0f); |
||||
} |
||||
|
||||
// End Foley
|
||||
// convert to 0-255 ranges
|
||||
r*=255; |
||||
g*=255; |
||||
b*=255; |
||||
|
||||
} |
||||
|
||||
static private float getRGBValue(float n1, float n2, float hue) |
||||
{ |
||||
// Helper function for the HSLToRGB function above
|
||||
if (hue>360.0f) |
||||
{ |
||||
hue-=360.0f; |
||||
} |
||||
else if (hue<0.0f) |
||||
{ |
||||
hue+=360.0f; |
||||
} |
||||
|
||||
if (hue<60.0) |
||||
{ |
||||
return n1+(n2-n1)*hue/60.0f; |
||||
} |
||||
else if (hue<180.0f) |
||||
{ |
||||
return n2; |
||||
} |
||||
else if (hue<240.0f) |
||||
{ |
||||
return n1+(n2-n1)*(240.0f-hue)/60.0f; |
||||
} |
||||
else |
||||
{ |
||||
return n1; |
||||
} |
||||
} |
||||
|
||||
static public void RGBToHSL(int r, int g, int b, ref float h, ref float s, ref float l) |
||||
{ |
||||
|
||||
float delta; |
||||
float fr = (float)r/255; |
||||
float fg = (float)g/255; |
||||
float fb = (float)b/255; |
||||
float max = Math.Max(fr,Math.Max(fg,fb)); |
||||
float min = Math.Min(fr,Math.Min(fg,fb)); |
||||
|
||||
//calc the lightness
|
||||
l = (max+min)/2; |
||||
|
||||
if (max==min) |
||||
{ |
||||
//should be undefined but this works for what we need
|
||||
s = 0; |
||||
h = 240.0f; |
||||
} |
||||
else |
||||
{ |
||||
|
||||
delta = max-min; |
||||
|
||||
//calc the Saturation
|
||||
if (l < 0.5) |
||||
{ |
||||
s = delta/(max+min); |
||||
} |
||||
else |
||||
{ |
||||
s = delta/(2.0f-(max+min)); |
||||
} |
||||
|
||||
//calc the hue
|
||||
if (fr==max) |
||||
{ |
||||
h = (fg-fb)/delta; |
||||
} |
||||
else if (fg==max) |
||||
{ |
||||
h = 2.0f + (fb-fr)/delta; |
||||
} |
||||
else if (fb==max) |
||||
{ |
||||
h = 4.0f + (fr-fg)/delta; |
||||
} |
||||
|
||||
//convert hue to degrees
|
||||
h*=60.0f; |
||||
if (h<0.0f) |
||||
{ |
||||
h+=360.0f; |
||||
} |
||||
} |
||||
|
||||
//convert to 0-255 ranges
|
||||
//h [0-360], h,l [0-1]
|
||||
l*=240; |
||||
s*=240; |
||||
h=(h/360)*240; |
||||
|
||||
} |
||||
#endregion
|
||||
|
||||
#region Visual Studio .NET colors calculation helpers
|
||||
|
||||
static public Color VSNetBackgroundColor |
||||
{ |
||||
get |
||||
{ |
||||
if ( useCustomColor && backgroundColor != Color.Empty ) |
||||
return backgroundColor; |
||||
else |
||||
return CalculateColor(SystemColors.Window, SystemColors.Control, 220); |
||||
} |
||||
set |
||||
{ |
||||
// Flag that we are going to use custom colors instead
|
||||
// of calculating the color based on the system colors
|
||||
// -- this is a way of hooking up into the VSNetColors that I use throughout
|
||||
// the UtilityLibrary
|
||||
useCustomColor = true; |
||||
backgroundColor = value; |
||||
} |
||||
} |
||||
|
||||
static public Color VSNetSelectionUnfocusedColor |
||||
{ |
||||
get |
||||
{ |
||||
if ( useCustomColor && selectionColor != Color.Empty ) |
||||
return selectionUnfocusedColor; |
||||
else |
||||
return CalculateColor(SystemColors.Highlight, SystemColors.Window, 25); |
||||
} |
||||
set |
||||
{ |
||||
// Flag that we are going to use custom colors instead
|
||||
// of calculating the color based on the system colors
|
||||
// -- this is a way of hooking up into the VSNetColor that I use throughout
|
||||
// the UtilityLibrary
|
||||
useCustomColor = true; |
||||
selectionUnfocusedColor = value; |
||||
} |
||||
} |
||||
|
||||
static public Color VSNetSelectionColor |
||||
{ |
||||
get |
||||
{ |
||||
if ( useCustomColor && selectionColor != Color.Empty ) |
||||
return selectionColor; |
||||
else |
||||
return CalculateColor(SystemColors.Highlight, SystemColors.Window, 70); |
||||
} |
||||
set |
||||
{ |
||||
// Flag that we are going to use custom colors instead
|
||||
// of calculating the color based on the system colors
|
||||
// -- this is a way of hooking up into the VSNetColor that I use throughout
|
||||
// the UtilityLibrary
|
||||
useCustomColor = true; |
||||
selectionColor = value; |
||||
} |
||||
} |
||||
|
||||
|
||||
static public Color VSNetControlColor |
||||
{ |
||||
get |
||||
{ if ( useCustomColor && controlColor != Color.Empty ) |
||||
return controlColor; |
||||
else |
||||
return CalculateColor(SystemColors.Control, VSNetBackgroundColor, 195); |
||||
} |
||||
set |
||||
{ |
||||
// Flag that we are going to use custom colors instead
|
||||
// of calculating the color based on the system colors
|
||||
// -- this is a way of hooking up into the VSNetColors that I use throughout
|
||||
// the UtilityLibrary
|
||||
useCustomColor = true; |
||||
controlColor = value; |
||||
} |
||||
|
||||
} |
||||
|
||||
static public Color VSNetPressedColor |
||||
{ |
||||
get |
||||
{ |
||||
if ( useCustomColor && pressedColor != Color.Empty ) |
||||
return pressedColor; |
||||
else |
||||
return CalculateColor(SystemColors.Highlight, ColorUtil.VSNetSelectionColor, 70); |
||||
} |
||||
set |
||||
{ |
||||
// Flag that we are going to use custom colors instead
|
||||
// of calculating the color based on the system colors
|
||||
// -- this is a way of hooking up into the VSNetColors that I use throughout
|
||||
// the UtilityLibrary
|
||||
useCustomColor = true; |
||||
pressedColor = value; |
||||
} |
||||
} |
||||
|
||||
|
||||
static public Color VSNetCheckedColor |
||||
{ |
||||
get |
||||
{ |
||||
if ( useCustomColor && pressedColor != Color.Empty ) |
||||
return checkedColor; |
||||
else |
||||
return CalculateColor(SystemColors.Highlight, SystemColors.Window, 30); |
||||
} |
||||
set |
||||
{ |
||||
// Flag that we are going to use custom colors instead
|
||||
// of calculating the color based on the system colors
|
||||
// -- this is a way of hooking up into the VSNetColors that I use throughout
|
||||
// the UtilityLibrary
|
||||
useCustomColor = true; |
||||
checkedColor = value; |
||||
} |
||||
} |
||||
|
||||
static public Color VSNetBorderColor |
||||
{ |
||||
get |
||||
{ |
||||
if ( useCustomColor && borderColor != Color.Empty ) |
||||
return borderColor; |
||||
else |
||||
{ |
||||
// This color is the default color unless we are using
|
||||
// custom colors
|
||||
return SystemColors.Highlight; |
||||
} |
||||
} |
||||
set |
||||
{ |
||||
// Flag that we are going to use custom colors instead
|
||||
// of calculating the color based on the system colors
|
||||
// -- this is a way of hooking up into the VSNetColors that I use throughout
|
||||
// the UtilityLibrary
|
||||
useCustomColor = true; |
||||
borderColor = value; |
||||
} |
||||
} |
||||
|
||||
public static Color CalculateColor(Color front, Color back, int alpha) |
||||
{ |
||||
|
||||
// Use alpha blending to brigthen the colors but don't use it
|
||||
// directly. Instead derive an opaque color that we can use.
|
||||
// -- if we use a color with alpha blending directly we won't be able
|
||||
// to paint over whatever color was in the background and there
|
||||
// would be shadows of that color showing through
|
||||
Color frontColor = Color.FromArgb(255, front); |
||||
Color backColor = Color.FromArgb(255, back); |
||||
|
||||
float frontRed = frontColor.R; |
||||
float frontGreen = frontColor.G; |
||||
float frontBlue = frontColor.B; |
||||
float backRed = backColor.R; |
||||
float backGreen = backColor.G; |
||||
float backBlue = backColor.B; |
||||
|
||||
float fRed = frontRed*alpha/255 + backRed*((float)(255-alpha)/255); |
||||
byte newRed = (byte)fRed; |
||||
float fGreen = frontGreen*alpha/255 + backGreen*((float)(255-alpha)/255); |
||||
byte newGreen = (byte)fGreen; |
||||
float fBlue = frontBlue*alpha/255 + backBlue*((float)(255-alpha)/255); |
||||
byte newBlue = (byte)fBlue; |
||||
|
||||
return Color.FromArgb(255, newRed, newGreen, newBlue); |
||||
|
||||
} |
||||
#endregion
|
||||
|
||||
#region General functions
|
||||
static public Color ColorFromPoint(Graphics g, int x, int y) |
||||
{ |
||||
IntPtr hDC = g.GetHdc(); |
||||
// Get the color of the pixel first
|
||||
uint colorref = APIsGdi.GetPixel(hDC, x, y); |
||||
byte Red = GetRValue(colorref); |
||||
byte Green = GetGValue(colorref); |
||||
byte Blue = GetBValue(colorref); |
||||
g.ReleaseHdc(hDC); |
||||
return Color.FromArgb(Red, Green, Blue); |
||||
} |
||||
|
||||
static public bool IsKnownColor(Color color, ref Color knownColor, bool useTransparent) |
||||
{ |
||||
|
||||
// Using the Color structrure "FromKnowColor" does not work if
|
||||
// we did not create the color as a known color to begin with
|
||||
// we need to compare the rgbs of both color
|
||||
Color currentColor = Color.Empty; |
||||
bool badColor = false; |
||||
for (KnownColor enumValue = 0; enumValue <= KnownColor.YellowGreen; enumValue++) |
||||
{ |
||||
currentColor = Color.FromKnownColor(enumValue); |
||||
string colorName = currentColor.Name; |
||||
if ( !useTransparent ) |
||||
badColor = (colorName == "Transparent"); |
||||
if ( color.A == currentColor.A && color.R == currentColor.R && color.G == currentColor.G |
||||
&& color.B == currentColor.B && !currentColor.IsSystemColor |
||||
&& !badColor ) |
||||
{ |
||||
knownColor = currentColor; |
||||
return true; |
||||
} |
||||
|
||||
} |
||||
return false; |
||||
|
||||
} |
||||
|
||||
static public bool IsSystemColor(Color color, ref Color knownColor) |
||||
{ |
||||
|
||||
// Using the Color structrure "FromKnowColor" does not work if
|
||||
// we did not create the color as a known color to begin with
|
||||
// we need to compare the rgbs of both color
|
||||
Color currentColor = Color.Empty; |
||||
for (KnownColor enumValue = 0; enumValue <= KnownColor.YellowGreen; enumValue++) |
||||
{ |
||||
currentColor = Color.FromKnownColor(enumValue); |
||||
string colorName = currentColor.Name; |
||||
if ( color.R == currentColor.R && color.G == currentColor.G |
||||
&& color.B == currentColor.B && currentColor.IsSystemColor ) |
||||
{ |
||||
knownColor = currentColor; |
||||
return true; |
||||
} |
||||
|
||||
} |
||||
return false; |
||||
} |
||||
|
||||
static public uint GetCOLORREF(Color color) |
||||
{ |
||||
return RGB(color.R, color.G, color.B); |
||||
} |
||||
|
||||
static public Color ColorFromRGBString(string text) |
||||
{ |
||||
|
||||
Color rgbColor = Color.Empty; |
||||
string[] RGBs = text.Split(','); |
||||
if ( RGBs.Length != 3 ) |
||||
{ |
||||
// If we don't have three pieces of information, then the
|
||||
// string is not properly formatted, inform the use
|
||||
throw new Exception("RGB color string is not well formed"); |
||||
} |
||||
|
||||
string stringR = RGBs[0]; |
||||
string stringG = RGBs[1]; |
||||
string stringB = RGBs[2]; |
||||
int R, G, B; |
||||
|
||||
try |
||||
{ |
||||
R = Convert.ToInt32(stringR); |
||||
G = Convert.ToInt32(stringG); |
||||
B = Convert.ToInt32(stringB); |
||||
if ( ( R < 0 || R > 255 ) || ( G < 0 || G > 255 ) || ( B < 0 || B > 255 ) ) |
||||
{ |
||||
throw new Exception("Out of bounds RGB value"); |
||||
} |
||||
else |
||||
{ |
||||
// Convert to color
|
||||
rgbColor = Color.FromArgb(R, G, B); |
||||
// See if we have either a web color or a systgem color
|
||||
Color knownColor = Color.Empty; |
||||
bool isKnown = ColorUtil.IsKnownColor( rgbColor, ref knownColor, true); |
||||
if ( !isKnown ) |
||||
isKnown = ColorUtil.IsSystemColor(rgbColor, ref knownColor); |
||||
if ( isKnown ) |
||||
rgbColor = knownColor; |
||||
} |
||||
} |
||||
catch ( InvalidCastException ) |
||||
{ |
||||
throw new Exception("Invalid RGB value"); |
||||
} |
||||
|
||||
return rgbColor; |
||||
} |
||||
static public Color LightColor(Color color, int inc) |
||||
{ |
||||
int red = color.R; |
||||
int green = color.G; |
||||
int blue = color.B; |
||||
|
||||
if ( red + inc <= 255 ) |
||||
red += inc; |
||||
if ( green + inc <= 255 ) |
||||
green += inc; |
||||
if ( blue + inc <= 255 ) |
||||
blue += inc; |
||||
|
||||
return Color.FromArgb(red, green, blue); |
||||
} |
||||
static public Color DarkColor(Color color, int inc) |
||||
{ |
||||
int red = color.R; |
||||
int green = color.G; |
||||
int blue = color.B; |
||||
|
||||
if ( red >= inc ) |
||||
red -= inc; |
||||
if ( green >= inc ) |
||||
green -= inc; |
||||
if ( blue >= inc ) |
||||
blue -= inc; |
||||
|
||||
return Color.FromArgb(red, green, blue); |
||||
|
||||
} |
||||
#endregion
|
||||
|
||||
#region Windows RGB related macros
|
||||
static public byte GetRValue(uint color) |
||||
{ |
||||
return (byte)color; |
||||
} |
||||
|
||||
static public byte GetGValue(uint color) |
||||
{ |
||||
return ((byte)(((short)(color)) >> 8)); |
||||
} |
||||
|
||||
static public byte GetBValue(uint color) |
||||
{ |
||||
return ((byte)((color)>>16)); |
||||
} |
||||
|
||||
static public uint RGB(int r, int g, int b) |
||||
{ |
||||
return ((uint)(((byte)(r)|((short)((byte)(g))<<8))|(((short)(byte)(b))<<16))); |
||||
|
||||
} |
||||
#endregion
|
||||
|
||||
} |
||||
} |
@ -1,161 +0,0 @@
@@ -1,161 +0,0 @@
|
||||
using System; |
||||
using System.Drawing; |
||||
using System.Drawing.Drawing2D; |
||||
|
||||
namespace System.Runtime.InteropServices.APIs |
||||
{ |
||||
/// <summary>
|
||||
/// Summary description for TextUtil.
|
||||
/// </summary>
|
||||
public class TextUtil |
||||
{ |
||||
#region Constructor
|
||||
// No need to construct this object
|
||||
private TextUtil() |
||||
{ |
||||
} |
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
public static Size GetTextSize(Graphics graphics, string text, Font font) |
||||
{ |
||||
IntPtr hdc = IntPtr.Zero; |
||||
if ( graphics != null ) |
||||
{ |
||||
// Get device context from the graphics passed in
|
||||
hdc = graphics.GetHdc(); |
||||
} |
||||
else |
||||
{ |
||||
// Get screen device context
|
||||
hdc = APIsGdi.GetDC(IntPtr.Zero); |
||||
} |
||||
|
||||
IntPtr fontHandle = font.ToHfont(); |
||||
IntPtr currentFontHandle = APIsGdi.SelectObject(hdc, fontHandle); |
||||
|
||||
APIsStructs.RECT rect = new APIsStructs.RECT(); |
||||
rect.left = 0; |
||||
rect.right = 0; |
||||
rect.top = 0; |
||||
rect.bottom = 0; |
||||
|
||||
APIsUser32.DrawText(hdc, text, text.Length, ref rect, |
||||
APIsEnums.DrawTextFormatFlags.SINGLELINE | APIsEnums.DrawTextFormatFlags.LEFT | APIsEnums.DrawTextFormatFlags.CALCRECT); |
||||
APIsGdi.SelectObject(hdc, currentFontHandle); |
||||
APIsGdi.DeleteObject(fontHandle); |
||||
|
||||
if(graphics != null) |
||||
graphics.ReleaseHdc(hdc); |
||||
else |
||||
APIsUser32.ReleaseDC(IntPtr.Zero, hdc); |
||||
|
||||
return new Size(rect.right - rect.left, rect.bottom - rect.top); |
||||
} |
||||
|
||||
public static Size GetTextSize(Graphics graphics, string text, Font font, ref Rectangle rc, APIsEnums.DrawTextFormatFlags drawFlags) |
||||
{ |
||||
IntPtr hdc = IntPtr.Zero; |
||||
if ( graphics != null ) |
||||
{ |
||||
// Get device context from the graphics passed in
|
||||
hdc = graphics.GetHdc(); |
||||
} |
||||
else |
||||
{ |
||||
// Get screen device context
|
||||
hdc = APIsGdi.GetDC(IntPtr.Zero); |
||||
} |
||||
|
||||
IntPtr fontHandle = font.ToHfont(); |
||||
IntPtr currentFontHandle = APIsGdi.SelectObject(hdc, fontHandle); |
||||
|
||||
APIsStructs.RECT rect = new APIsStructs.RECT(); |
||||
rect.left = rc.Left; |
||||
rect.right = rc.Right; |
||||
rect.top = rc.Top; |
||||
rect.bottom = rc.Bottom; |
||||
|
||||
APIsUser32.DrawText(hdc, text, text.Length, ref rect, drawFlags); |
||||
APIsGdi.SelectObject(hdc, currentFontHandle); |
||||
APIsGdi.DeleteObject(fontHandle); |
||||
|
||||
if(graphics != null) |
||||
graphics.ReleaseHdc(hdc); |
||||
else |
||||
APIsUser32.ReleaseDC(IntPtr.Zero, hdc); |
||||
|
||||
return new Size(rect.right - rect.left, rect.bottom - rect.top); |
||||
|
||||
} |
||||
|
||||
public static void DrawText(Graphics graphics, string text, Font font, Rectangle rect) |
||||
{ |
||||
IntPtr hdc = graphics.GetHdc(); |
||||
IntPtr fontHandle = font.ToHfont(); |
||||
IntPtr currentFontHandle = APIsGdi.SelectObject(hdc, fontHandle); |
||||
APIsGdi.SetBkMode(hdc, APIsEnums.BackgroundMode.TRANSPARENT); |
||||
|
||||
APIsStructs.RECT rc = new APIsStructs.RECT(); |
||||
rc.left = rect.Left; |
||||
rc.top = rect.Top; |
||||
rc.right = rc.left + rect.Width; |
||||
rc.bottom = rc.top + rect.Height; |
||||
|
||||
APIsUser32.DrawText(hdc, text, text.Length, ref rc, |
||||
APIsEnums.DrawTextFormatFlags.SINGLELINE | APIsEnums.DrawTextFormatFlags.LEFT |
||||
| APIsEnums.DrawTextFormatFlags.MODIFYSTRING | APIsEnums.DrawTextFormatFlags.WORD_ELLIPSIS); |
||||
APIsGdi.SelectObject(hdc, currentFontHandle); |
||||
APIsGdi.DeleteObject(fontHandle); |
||||
graphics.ReleaseHdc(hdc); |
||||
} |
||||
|
||||
public static void DrawText(Graphics graphics, string text, Font font, Rectangle rect, Color textColor) |
||||
{ |
||||
IntPtr hdc = graphics.GetHdc(); |
||||
IntPtr fontHandle = font.ToHfont(); |
||||
IntPtr currentFontHandle = APIsGdi.SelectObject(hdc, fontHandle); |
||||
uint colorRef = ColorUtil.GetCOLORREF(textColor); |
||||
APIsGdi.SetTextColor(hdc, colorRef); |
||||
APIsGdi.SetBkMode(hdc, APIsEnums.BackgroundMode.TRANSPARENT); |
||||
|
||||
APIsStructs.RECT rc = new APIsStructs.RECT(); |
||||
rc.left = rect.Left; |
||||
rc.top = rect.Top; |
||||
rc.right = rc.left + rect.Width; |
||||
rc.bottom = rc.top + rect.Height; |
||||
|
||||
APIsUser32.DrawText(hdc, text, text.Length, ref rc, |
||||
APIsEnums.DrawTextFormatFlags.SINGLELINE | APIsEnums.DrawTextFormatFlags.LEFT |
||||
| APIsEnums.DrawTextFormatFlags.MODIFYSTRING| APIsEnums.DrawTextFormatFlags.WORD_ELLIPSIS); |
||||
APIsGdi.SelectObject(hdc, currentFontHandle); |
||||
APIsGdi.DeleteObject(fontHandle); |
||||
graphics.ReleaseHdc(hdc); |
||||
} |
||||
|
||||
public static void DrawReverseString(Graphics g, |
||||
String drawText, |
||||
Font drawFont, |
||||
Rectangle drawRect, |
||||
Brush drawBrush, |
||||
StringFormat drawFormat) |
||||
{ |
||||
GraphicsContainer container = g.BeginContainer(); |
||||
|
||||
// The text will be rotated around the origin (0,0) and so needs moving
|
||||
// back into position by using a transform
|
||||
g.TranslateTransform(drawRect.Left * 2 + drawRect.Width, |
||||
drawRect.Top * 2 + drawRect.Height); |
||||
|
||||
// Rotate the text by 180 degress to reverse the direction
|
||||
g.RotateTransform(180); |
||||
|
||||
// Draw the string as normal and let then transforms do the work
|
||||
g.DrawString(drawText, drawFont, drawBrush, drawRect, drawFormat); |
||||
|
||||
g.EndContainer(container); |
||||
} |
||||
|
||||
#endregion
|
||||
} |
||||
} |
@ -1,281 +0,0 @@
@@ -1,281 +0,0 @@
|
||||
using System; |
||||
using System.ComponentModel; |
||||
using System.Drawing.Design; |
||||
using System.Windows.Forms.Design; |
||||
|
||||
namespace System.Windows.Forms |
||||
{ |
||||
/// <summary>
|
||||
/// Editor for the TreeListView.Items property
|
||||
/// </summary>
|
||||
public class TreeListViewItemsEditorForm : System.Windows.Forms.Form |
||||
{ |
||||
private TreeListViewItemCollection _items; |
||||
/// <summary>
|
||||
/// Get the items that are edited in this form
|
||||
/// </summary>
|
||||
public TreeListViewItemCollection Items{get{return(_items);}} |
||||
private System.Windows.Forms.Button buttonOk; |
||||
private System.Windows.Forms.GroupBox groupBox1; |
||||
private System.Windows.Forms.TreeView treeView1; |
||||
private System.Windows.Forms.Splitter splitter1; |
||||
private System.Windows.Forms.PropertyGrid propertyGrid1; |
||||
private System.Windows.Forms.Button buttonRemove; |
||||
private System.Windows.Forms.Button buttonAdd; |
||||
private System.ComponentModel.Container components = null; |
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="collection"></param>
|
||||
public TreeListViewItemsEditorForm(TreeListViewItemCollection collection) |
||||
{ |
||||
InitializeComponent(); |
||||
_items = collection; |
||||
treeView1.SelectedNode = null; |
||||
foreach(TreeListViewItem item in _items) |
||||
{ |
||||
TreeNode node = new TreeNode(item.Text); |
||||
node.Tag = item; |
||||
treeView1.Nodes.Add(node); |
||||
AddChildren(node); |
||||
node.Expand(); |
||||
} |
||||
} |
||||
private void AddChildren(TreeNode node) |
||||
{ |
||||
TreeListViewItem tlvitem = (TreeListViewItem) node.Tag; |
||||
foreach(TreeListViewItem item in tlvitem.Items) |
||||
{ |
||||
TreeNode child = new TreeNode(item.Text); |
||||
child.Tag = item; |
||||
node.Nodes.Add(child); |
||||
AddChildren(child); |
||||
child.Expand(); |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Nettoyage des ressources utilisées.
|
||||
/// </summary>
|
||||
protected override void Dispose( bool disposing ) |
||||
{ |
||||
if( disposing ) |
||||
{ |
||||
if(components != null) |
||||
{ |
||||
components.Dispose(); |
||||
} |
||||
} |
||||
base.Dispose( disposing ); |
||||
} |
||||
|
||||
#region Windows Form Designer generated code
|
||||
/// <summary>
|
||||
/// Méthode requise pour la prise en charge du concepteur - ne modifiez pas
|
||||
/// le contenu de cette méthode avec l'éditeur de code.
|
||||
/// </summary>
|
||||
private void InitializeComponent() |
||||
{ |
||||
this.buttonOk = new System.Windows.Forms.Button(); |
||||
this.groupBox1 = new System.Windows.Forms.GroupBox(); |
||||
this.propertyGrid1 = new System.Windows.Forms.PropertyGrid(); |
||||
this.buttonRemove = new System.Windows.Forms.Button(); |
||||
this.buttonAdd = new System.Windows.Forms.Button(); |
||||
this.splitter1 = new System.Windows.Forms.Splitter(); |
||||
this.treeView1 = new System.Windows.Forms.TreeView(); |
||||
this.groupBox1.SuspendLayout(); |
||||
this.SuspendLayout(); |
||||
//
|
||||
// buttonOk
|
||||
//
|
||||
this.buttonOk.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right); |
||||
this.buttonOk.Location = new System.Drawing.Point(360, 344); |
||||
this.buttonOk.Name = "buttonOk"; |
||||
this.buttonOk.TabIndex = 0; |
||||
this.buttonOk.Text = "Ok"; |
||||
this.buttonOk.Click += new System.EventHandler(this.buttonOk_Click); |
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) |
||||
| System.Windows.Forms.AnchorStyles.Left) |
||||
| System.Windows.Forms.AnchorStyles.Right); |
||||
this.groupBox1.Controls.AddRange(new System.Windows.Forms.Control[] { |
||||
this.propertyGrid1, |
||||
this.buttonRemove, |
||||
this.buttonAdd, |
||||
this.splitter1, |
||||
this.treeView1}); |
||||
this.groupBox1.FlatStyle = System.Windows.Forms.FlatStyle.System; |
||||
this.groupBox1.Location = new System.Drawing.Point(8, 8); |
||||
this.groupBox1.Name = "groupBox1"; |
||||
this.groupBox1.Size = new System.Drawing.Size(428, 328); |
||||
this.groupBox1.TabIndex = 2; |
||||
this.groupBox1.TabStop = false; |
||||
//
|
||||
// propertyGrid1
|
||||
//
|
||||
this.propertyGrid1.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) |
||||
| System.Windows.Forms.AnchorStyles.Left) |
||||
| System.Windows.Forms.AnchorStyles.Right); |
||||
this.propertyGrid1.CommandsVisibleIfAvailable = true; |
||||
this.propertyGrid1.LargeButtons = false; |
||||
this.propertyGrid1.LineColor = System.Drawing.SystemColors.ScrollBar; |
||||
this.propertyGrid1.Location = new System.Drawing.Point(192, 16); |
||||
this.propertyGrid1.Name = "propertyGrid1"; |
||||
this.propertyGrid1.Size = new System.Drawing.Size(232, 272); |
||||
this.propertyGrid1.TabIndex = 7; |
||||
this.propertyGrid1.Text = "propertyGrid1"; |
||||
this.propertyGrid1.ViewBackColor = System.Drawing.SystemColors.Window; |
||||
this.propertyGrid1.ViewForeColor = System.Drawing.SystemColors.WindowText; |
||||
this.propertyGrid1.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.propertyGrid1_PropertyValueChanged); |
||||
//
|
||||
// buttonRemove
|
||||
//
|
||||
this.buttonRemove.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right); |
||||
this.buttonRemove.Location = new System.Drawing.Point(344, 296); |
||||
this.buttonRemove.Name = "buttonRemove"; |
||||
this.buttonRemove.TabIndex = 6; |
||||
this.buttonRemove.Text = "Remove"; |
||||
this.buttonRemove.Click += new System.EventHandler(this.buttonRemove_Click); |
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
this.buttonAdd.Anchor = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left); |
||||
this.buttonAdd.Location = new System.Drawing.Point(192, 296); |
||||
this.buttonAdd.Name = "buttonAdd"; |
||||
this.buttonAdd.TabIndex = 5; |
||||
this.buttonAdd.Text = "Add"; |
||||
this.buttonAdd.Click += new System.EventHandler(this.buttonAdd_Click); |
||||
//
|
||||
// splitter1
|
||||
//
|
||||
this.splitter1.Location = new System.Drawing.Point(184, 16); |
||||
this.splitter1.Name = "splitter1"; |
||||
this.splitter1.Size = new System.Drawing.Size(3, 309); |
||||
this.splitter1.TabIndex = 4; |
||||
this.splitter1.TabStop = false; |
||||
//
|
||||
// treeView1
|
||||
//
|
||||
this.treeView1.Dock = System.Windows.Forms.DockStyle.Left; |
||||
this.treeView1.ImageIndex = -1; |
||||
this.treeView1.Location = new System.Drawing.Point(3, 16); |
||||
this.treeView1.Name = "treeView1"; |
||||
this.treeView1.SelectedImageIndex = -1; |
||||
this.treeView1.Size = new System.Drawing.Size(181, 309); |
||||
this.treeView1.TabIndex = 3; |
||||
this.treeView1.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeView1_AfterSelect); |
||||
//
|
||||
// TreeListViewItemsEditorForm
|
||||
//
|
||||
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); |
||||
this.ClientSize = new System.Drawing.Size(444, 375); |
||||
this.Controls.AddRange(new System.Windows.Forms.Control[] { |
||||
this.groupBox1, |
||||
this.buttonOk}); |
||||
this.MinimumSize = new System.Drawing.Size(384, 384); |
||||
this.Name = "TreeListViewItemsEditorForm"; |
||||
this.Text = "TreeListViewItemsEditorForm"; |
||||
this.groupBox1.ResumeLayout(false); |
||||
this.ResumeLayout(false); |
||||
|
||||
} |
||||
#endregion
|
||||
|
||||
private void buttonOk_Click(object sender, System.EventArgs e) |
||||
{ |
||||
DialogResult = DialogResult.OK; |
||||
Close(); |
||||
} |
||||
|
||||
private void treeView1_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e) |
||||
{ |
||||
propertyGrid1.SelectedObject = (TreeListViewItem) e.Node.Tag; |
||||
} |
||||
|
||||
private void buttonRemove_Click(object sender, System.EventArgs e) |
||||
{ |
||||
if(treeView1.SelectedNode == null) return; |
||||
TreeListViewItem item = (TreeListViewItem) treeView1.SelectedNode.Tag; |
||||
item.Remove(); |
||||
treeView1.SelectedNode.Remove(); |
||||
} |
||||
|
||||
private void buttonAdd_Click(object sender, System.EventArgs e) |
||||
{ |
||||
try |
||||
{ |
||||
TreeListViewItem newitem = new TreeListViewItem("treeListView" + _items.Owner.ItemsCount.ToString()); |
||||
TreeNode node = new TreeNode(newitem.Text); |
||||
node.Tag = newitem; |
||||
if(treeView1.SelectedNode != null) |
||||
{ |
||||
TreeListViewItem item = (TreeListViewItem) treeView1.SelectedNode.Tag; |
||||
if(item.Items.Add(newitem) > -1) treeView1.SelectedNode.Nodes.Add(node); |
||||
} |
||||
else |
||||
if(_items.Add(newitem) > -1) treeView1.Nodes.Add(node); |
||||
if(node.Index > -1) treeView1.SelectedNode = node; |
||||
} |
||||
catch(Exception ex){MessageBox.Show(ex.Message);} |
||||
} |
||||
|
||||
private void propertyGrid1_PropertyValueChanged(object s, System.Windows.Forms.PropertyValueChangedEventArgs e) |
||||
{ |
||||
if(treeView1.SelectedNode == null) return; |
||||
if(e.ChangedItem.Label == "Text") |
||||
treeView1.SelectedNode.Text = (string) e.ChangedItem.Value; |
||||
} |
||||
} |
||||
/// <summary>
|
||||
/// UITypeEditor for the TreeListView.Items property
|
||||
/// </summary>
|
||||
public class TreeListViewItemsEditor : UITypeEditor |
||||
{ |
||||
private IWindowsFormsEditorService edSvc = null; |
||||
private TreeListViewItemsEditorForm editor = null; |
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
public TreeListViewItemsEditor() |
||||
{ |
||||
} |
||||
/// <summary>
|
||||
/// Shows a dropdown icon in the property editor
|
||||
/// </summary>
|
||||
/// <param name="context">The context of the editing control</param>
|
||||
/// <returns>Returns <c>UITypeEditorEditStyle.DropDown</c></returns>
|
||||
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context) |
||||
{ |
||||
return UITypeEditorEditStyle.Modal; |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Overrides the method used to provide basic behaviour for selecting editor.
|
||||
/// Shows our custom control for editing the value.
|
||||
/// </summary>
|
||||
/// <param name="context">The context of the editing control</param>
|
||||
/// <param name="provider">A valid service provider</param>
|
||||
/// <param name="value">The current value of the object to edit</param>
|
||||
/// <returns>The new value of the object</returns>
|
||||
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) |
||||
{ |
||||
if (context != null |
||||
&& context.Instance != null |
||||
&& provider != null) |
||||
{ |
||||
edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); |
||||
if(edSvc != null) |
||||
{ |
||||
editor = new TreeListViewItemsEditorForm((TreeListViewItemCollection) value); |
||||
edSvc.ShowDialog(editor); |
||||
if(editor.DialogResult == DialogResult.OK) |
||||
return(editor.Items); |
||||
} |
||||
} |
||||
return(value); |
||||
} |
||||
} |
||||
} |
@ -1,105 +0,0 @@
@@ -1,105 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<root> |
||||
<!-- |
||||
Microsoft ResX Schema |
||||
|
||||
Version 1.3 |
||||
|
||||
The primary goals of this format is to allow a simple XML format |
||||
that is mostly human readable. The generation and parsing of the |
||||
various data types are done through the TypeConverter classes |
||||
associated with the data types. |
||||
|
||||
Example: |
||||
|
||||
... ado.net/XML headers & schema ... |
||||
<resheader name="resmimetype">text/microsoft-resx</resheader> |
||||
<resheader name="version">1.3</resheader> |
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> |
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> |
||||
<data name="Name1">this is my long string</data> |
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> |
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> |
||||
[base64 mime encoded serialized .NET Framework object] |
||||
</data> |
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> |
||||
[base64 mime encoded string representing a byte array form of the .NET Framework object] |
||||
</data> |
||||
|
||||
There are any number of "resheader" rows that contain simple |
||||
name/value pairs. |
||||
|
||||
Each data row contains a name, and value. The row also contains a |
||||
type or mimetype. Type corresponds to a .NET class that support |
||||
text/value conversion through the TypeConverter architecture. |
||||
Classes that don't support this are serialized and stored with the |
||||
mimetype set. |
||||
|
||||
The mimetype is used for serialized objects, and tells the |
||||
ResXResourceReader how to depersist the object. This is currently not |
||||
extensible. For a given mimetype the value must be set accordingly: |
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format |
||||
that the ResXResourceWriter will generate, however the reader can |
||||
read any of the formats listed below. |
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64 |
||||
value : The object must be serialized with |
||||
: System.Serialization.Formatters.Binary.BinaryFormatter |
||||
: and then encoded with base64 encoding. |
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64 |
||||
value : The object must be serialized with |
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter |
||||
: and then encoded with base64 encoding. |
||||
mimetype: application/x-microsoft.net.object.bytearray.base64 |
||||
value : The object must be serialized into a byte array |
||||
: using a System.ComponentModel.TypeConverter |
||||
: and then encoded with base64 encoding. |
||||
--> |
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> |
||||
<xsd:element name="root" msdata:IsDataSet="true"> |
||||
<xsd:complexType> |
||||
<xsd:choice maxOccurs="unbounded"> |
||||
<xsd:element name="data"> |
||||
<xsd:complexType> |
||||
<xsd:sequence> |
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> |
||||
</xsd:sequence> |
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> |
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> |
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
<xsd:element name="resheader"> |
||||
<xsd:complexType> |
||||
<xsd:sequence> |
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
||||
</xsd:sequence> |
||||
<xsd:attribute name="name" type="xsd:string" use="required" /> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
</xsd:choice> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
</xsd:schema> |
||||
<resheader name="resmimetype"> |
||||
<value>text/microsoft-resx</value> |
||||
</resheader> |
||||
<resheader name="version"> |
||||
<value>1.3</value> |
||||
</resheader> |
||||
<resheader name="reader"> |
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
||||
</resheader> |
||||
<resheader name="writer"> |
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
||||
</resheader> |
||||
<data name="$this.GridSize" type="System.Drawing.Size, System.Drawing, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> |
||||
<value>8, 8</value> |
||||
</data> |
||||
<data name="$this.Name"> |
||||
<value>TreeListViewItemsEditorForm</value> |
||||
</data> |
||||
</root> |
@ -1,27 +0,0 @@
@@ -1,27 +0,0 @@
|
||||
using System; |
||||
|
||||
namespace System.Windows.Forms |
||||
{ |
||||
/// <summary>
|
||||
/// Interface ITreeListViewItemComparer
|
||||
/// </summary>
|
||||
public interface ITreeListViewItemComparer : System.Collections.IComparer |
||||
{ |
||||
/// <summary>
|
||||
/// Sort order
|
||||
/// </summary>
|
||||
SortOrder SortOrder |
||||
{ |
||||
get; |
||||
set; |
||||
} |
||||
/// <summary>
|
||||
/// Column for the comparison
|
||||
/// </summary>
|
||||
int Column |
||||
{ |
||||
get; |
||||
set; |
||||
} |
||||
} |
||||
} |
Before Width: | Height: | Size: 894 B |
Before Width: | Height: | Size: 897 B |
@ -1,49 +0,0 @@
@@ -1,49 +0,0 @@
|
||||
using System; |
||||
|
||||
namespace System.Windows.Forms |
||||
{ |
||||
/// <summary>
|
||||
/// Collection of selected items in a TreeListView
|
||||
/// </summary>
|
||||
public class SelectedTreeListViewItemCollection : ListView.SelectedListViewItemCollection |
||||
{ |
||||
#region Properties
|
||||
/// <summary>
|
||||
/// Gets a TreeListViewItem at the specified index
|
||||
/// </summary>
|
||||
new public TreeListViewItem this[int index] |
||||
{ |
||||
get{return((TreeListViewItem) base[index]);} |
||||
} |
||||
#endregion
|
||||
#region Constructor
|
||||
/// <summary>
|
||||
/// Create a new instance of a SelectedTreeListViewItemCollection
|
||||
/// </summary>
|
||||
/// <param name="TreeListView"></param>
|
||||
public SelectedTreeListViewItemCollection(TreeListView TreeListView) : base((ListView) TreeListView) |
||||
{ |
||||
} |
||||
#endregion
|
||||
#region Functions
|
||||
/// <summary>
|
||||
/// Returns true if the specified item is in the collection
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <returns></returns>
|
||||
public bool Contains(TreeListViewItem item) |
||||
{ |
||||
return(base.Contains((ListViewItem) item)); |
||||
} |
||||
/// <summary>
|
||||
/// Index of an item
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <returns></returns>
|
||||
public int IndexOf(TreeListViewItem item) |
||||
{ |
||||
return(base.IndexOf((ListViewItem) item)); |
||||
} |
||||
#endregion
|
||||
} |
||||
} |
File diff suppressed because it is too large
Load Diff
@ -1,137 +0,0 @@
@@ -1,137 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<root> |
||||
<!-- |
||||
Microsoft ResX Schema |
||||
|
||||
Version 1.3 |
||||
|
||||
The primary goals of this format is to allow a simple XML format |
||||
that is mostly human readable. The generation and parsing of the |
||||
various data types are done through the TypeConverter classes |
||||
associated with the data types. |
||||
|
||||
Example: |
||||
|
||||
... ado.net/XML headers & schema ... |
||||
<resheader name="resmimetype">text/microsoft-resx</resheader> |
||||
<resheader name="version">1.3</resheader> |
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> |
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> |
||||
<data name="Name1">this is my long string</data> |
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> |
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> |
||||
[base64 mime encoded serialized .NET Framework object] |
||||
</data> |
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> |
||||
[base64 mime encoded string representing a byte array form of the .NET Framework object] |
||||
</data> |
||||
|
||||
There are any number of "resheader" rows that contain simple |
||||
name/value pairs. |
||||
|
||||
Each data row contains a name, and value. The row also contains a |
||||
type or mimetype. Type corresponds to a .NET class that support |
||||
text/value conversion through the TypeConverter architecture. |
||||
Classes that don't support this are serialized and stored with the |
||||
mimetype set. |
||||
|
||||
The mimetype is used for serialized objects, and tells the |
||||
ResXResourceReader how to depersist the object. This is currently not |
||||
extensible. For a given mimetype the value must be set accordingly: |
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format |
||||
that the ResXResourceWriter will generate, however the reader can |
||||
read any of the formats listed below. |
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64 |
||||
value : The object must be serialized with |
||||
: System.Serialization.Formatters.Binary.BinaryFormatter |
||||
: and then encoded with base64 encoding. |
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64 |
||||
value : The object must be serialized with |
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter |
||||
: and then encoded with base64 encoding. |
||||
mimetype: application/x-microsoft.net.object.bytearray.base64 |
||||
value : The object must be serialized into a byte array |
||||
: using a System.ComponentModel.TypeConverter |
||||
: and then encoded with base64 encoding. |
||||
--> |
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> |
||||
<xsd:element name="root" msdata:IsDataSet="true"> |
||||
<xsd:complexType> |
||||
<xsd:choice maxOccurs="unbounded"> |
||||
<xsd:element name="data"> |
||||
<xsd:complexType> |
||||
<xsd:sequence> |
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> |
||||
</xsd:sequence> |
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> |
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> |
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
<xsd:element name="resheader"> |
||||
<xsd:complexType> |
||||
<xsd:sequence> |
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
||||
</xsd:sequence> |
||||
<xsd:attribute name="name" type="xsd:string" use="required" /> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
</xsd:choice> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
</xsd:schema> |
||||
<resheader name="resmimetype"> |
||||
<value>text/microsoft-resx</value> |
||||
</resheader> |
||||
<resheader name="version"> |
||||
<value>1.3</value> |
||||
</resheader> |
||||
<resheader name="reader"> |
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
||||
</resheader> |
||||
<resheader name="writer"> |
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
||||
</resheader> |
||||
<data name="imageList1.Location" type="System.Drawing.Point, System.Drawing, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> |
||||
<value>17, 17</value> |
||||
</data> |
||||
<data name="plusMinusImageList.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> |
||||
<value>Assembly</value> |
||||
</data> |
||||
<data name="plusMinusImageList.Location" type="System.Drawing.Point, System.Drawing, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> |
||||
<value>122, 17</value> |
||||
</data> |
||||
<data name="plusMinusImageList.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64"> |
||||
<value> |
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFpTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0xLjAuMzMw |
||||
MC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZT |
||||
eXN0ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMA |
||||
AACoAwAAAk1TRnQBSQFMAgEBAgEAAQUBAAEEAQABEAEAARABAAT/ASEBEAj/AUIBTQE2BwABNgMAASgD |
||||
AAFAAwABIAMAAQEBAAEgBgABIP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8A/wD/AP8AIgCA/4AAgP+A |
||||
AID/gACA/4AADP8D6gH/A+MB/wPXAf8D1wH/A9cB/wPXAf8D1wH/A9cB/wPqHf8D6gH/A+MB/wPXAf8D |
||||
1wH/A9cB/wPXAf8D1wH/A9cB/wPxEf+AAAz/AswBmQH/A9cB/wPAAf8DsgH/A7IB/wGZAswB/wOyAf8D |
||||
sgH/A8wd/wLMAZkB/wPXAf8DwAH/A7IB/wPAAf8DsgH/A7IB/wPAAf8CzAGZEf+AAAz/AswBmQH/A+MB |
||||
/wPXAf8DzAH/AwAB/wPMAf8DzAH/A8sB/wLMAZkd/wLMAZkB/wPjAf8D1wH/A8wB/wPMAf8DzAH/A8wB |
||||
/wPLAf8CzAGZEf+AAAz/AswBmQH/A/EB/wPqAf8D6gH/AwAB/wPjAf8D1wH/A9cB/wPMAf8B8AH7Gv8C |
||||
zAGZAf8D8QH/A+oB/wPqAf8D4wH/A+MB/wPjAf8DzAH/A8wB/wPxDf+AAAz/AswBmQH/A/EB/wMAAf8D |
||||
AAH/AwAB/wMAAf8DAAH/A9cB/wPMHf8CzAGZAf8D8QH/AwAB/wMAAf8DAAH/AwAB/wMAAf8D1wH/A8wR |
||||
/4AADP8CzAGZAf8D8QH/A/EB/wPxAf8DAAH/A/EB/wPqAf8D4wH/AswBmR3/AswBmQH/A/EB/wPxAf8D |
||||
8QH/A/EB/wPxAf8D6gH/A+MB/wPMAf8B8AH7Dv+AAAz/AswBmQH/AfAB+wL/A/EF/wMAAf8B8AH7Av8D |
||||
8QH/A/EB/wPMAf8D8Rn/AswBmQH/AfAB+wL/A/EF/wHwAfsC/wPxBf8D8QH/AswBmRH/gAAM/wLMAZkB |
||||
/wHwAfsG/wHwAfsG/wHwAfsG/wHwAfsC/wPXHf8CzAGZAf8B8AH7Bv8B8AH7Bv8B8AH7Bv8B8AH7Av8D |
||||
1xH/gAAM/wPjAf8CzAGZAf8CzAGZAf8CzAGZAf8CzAGZAf8CzAGZAf8CzAGZAf8CzAGZAf8D4x3/A+MB |
||||
/wLMAZkB/wLMAZkB/wLMAZkB/wLMAZkB/wLMAZkB/wLMAZkB/wLMAZkB/wPjEf+AAID/gACA/4AAgP+A |
||||
AAFCAU0BPgcAAT4DAAEoAwABQAMAASADAAEBAQABAQYAAQEWAAP//wAYAAs= |
||||
</value> |
||||
</data> |
||||
<data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> |
||||
<value>False</value> |
||||
</data> |
||||
<data name="$this.Name"> |
||||
<value>TreeListView</value> |
||||
</data> |
||||
</root> |
@ -1,999 +0,0 @@
@@ -1,999 +0,0 @@
|
||||
using System; |
||||
using System.ComponentModel; |
||||
using System.Diagnostics; |
||||
using System.Drawing; |
||||
using System.Runtime.InteropServices.APIs; |
||||
|
||||
namespace System.Windows.Forms |
||||
{ |
||||
#region TreeListViewItemBoundsPortion
|
||||
/// <summary>
|
||||
/// Specifies a portion of the tree list view item from which to retrieve the bounding rectangle
|
||||
/// </summary>
|
||||
[Serializable] |
||||
public enum TreeListViewItemBoundsPortion |
||||
{ |
||||
/// <summary>
|
||||
/// The bounding rectangle of the entire item, including the icon, the item text, and the subitem text (if displayed), should be retrieved
|
||||
/// </summary>
|
||||
Entire = (int)ItemBoundsPortion.Entire, |
||||
/// <summary>
|
||||
/// The bounding rectangle of the icon or small icon should be retrieved
|
||||
/// </summary>
|
||||
Icon = (int)ItemBoundsPortion.Icon, |
||||
/// <summary>
|
||||
/// The bounding rectangle specified by the Entire value without the subitems
|
||||
/// </summary>
|
||||
ItemOnly = (int)ItemBoundsPortion.ItemOnly, |
||||
/// <summary>
|
||||
/// The bounding rectangle of the item text should be retrieved
|
||||
/// </summary>
|
||||
Label = (int)ItemBoundsPortion.Label, |
||||
/// <summary>
|
||||
/// The bounding rectangle of the item plus minus
|
||||
/// </summary>
|
||||
PlusMinus = 4 |
||||
} |
||||
#endregion
|
||||
/// <summary>
|
||||
/// Represents an item in a TreeListView control
|
||||
/// </summary>
|
||||
public class TreeListViewItem : ListViewItem |
||||
{ |
||||
#region Private delegates
|
||||
private delegate void ChangeChildrenCheckStateRecursivelyHandler(CheckState state); |
||||
private delegate TreeListViewItemCollection GetCollectionHandler(); |
||||
private delegate string GetStringHandler(); |
||||
private delegate bool GetBoolHandler(); |
||||
private delegate int GetIntHandler(); |
||||
private delegate TreeListViewItem GetTreeListViewItemHandler(); |
||||
#endregion
|
||||
|
||||
#region Events
|
||||
/// <summary>
|
||||
/// TreeListViewItemHandler delegate
|
||||
/// </summary>
|
||||
public delegate void TreeListViewItemHanlder(object sender); |
||||
/// <summary>
|
||||
/// TreeListViewItemCheckedHandler delegate
|
||||
/// </summary>
|
||||
public delegate void TreeListViewItemCheckedHandler(object sender, bool ischecked); |
||||
/// <summary>
|
||||
/// Occurs after the tree node is collapsed
|
||||
/// </summary>
|
||||
public event TreeListViewItemHanlder AfterCollapse; |
||||
/// <summary>
|
||||
/// Occurs after the tree node is expanded
|
||||
/// </summary>
|
||||
public event TreeListViewItemHanlder AfterExpand; |
||||
#endregion
|
||||
#region Properties
|
||||
#region NextVisibleItem
|
||||
/// <summary>
|
||||
/// Gets the next visible item in the TreeListView
|
||||
/// </summary>
|
||||
public TreeListViewItem NextVisibleItem |
||||
{ |
||||
get |
||||
{ |
||||
if(!IsInATreeListView || !Visible) return null; |
||||
ListView listview = (ListView) TreeListView; |
||||
if(Index >= listview.Items.Count-1) return null; |
||||
return (TreeListViewItem)listview.Items[Index+1]; |
||||
} |
||||
} |
||||
#endregion
|
||||
#region PrevVisibleItem
|
||||
/// <summary>
|
||||
/// Gets the previous visible item in the TreeListView
|
||||
/// </summary>
|
||||
public TreeListViewItem PrevVisibleItem |
||||
{ |
||||
get |
||||
{ |
||||
if(!IsInATreeListView || !Visible) return null; |
||||
ListView listview = (ListView) TreeListView; |
||||
if(Index < 1) return null; |
||||
return (TreeListViewItem)listview.Items[Index-1]; |
||||
} |
||||
} |
||||
#endregion
|
||||
|
||||
#region Checked properties
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the item is checked.
|
||||
/// </summary>
|
||||
public new bool Checked |
||||
{ |
||||
get |
||||
{ |
||||
try |
||||
{ |
||||
return (base.Checked); |
||||
} |
||||
catch |
||||
{ |
||||
return false; |
||||
} |
||||
} |
||||
set |
||||
{ |
||||
if(IsInATreeListView) |
||||
if(TreeListView.InvokeRequired) |
||||
throw(new Exception("Invoke required")); |
||||
try |
||||
{ |
||||
// Check downwards recursively
|
||||
if(ListView != null && |
||||
ListView._checkDirection == CheckDirection.Downwards && |
||||
_items.Count > 0) |
||||
{ |
||||
foreach(TreeListViewItem childItem in _items) |
||||
childItem.Checked = value; |
||||
} |
||||
if(base.Checked == value) return; |
||||
base.Checked = value; |
||||
} |
||||
catch{} |
||||
} |
||||
} |
||||
#endregion
|
||||
#region CheckStatus
|
||||
/// <summary>
|
||||
/// Gets the check state of this item
|
||||
/// </summary>
|
||||
public CheckState CheckStatus |
||||
{ |
||||
get |
||||
{ |
||||
if(_items.Count <= 0) |
||||
{ |
||||
if(this.Checked) |
||||
return CheckState.Checked; |
||||
else |
||||
return CheckState.Unchecked; |
||||
} |
||||
else |
||||
{ |
||||
bool allChecked = true; |
||||
bool allUnChecked = true; |
||||
|
||||
TreeListViewItem[] items = Items.ToArray(); |
||||
foreach(TreeListViewItem item in items) |
||||
{ |
||||
if (item.CheckStatus == CheckState.Indeterminate) |
||||
return CheckState.Indeterminate; |
||||
else if (item.CheckStatus == CheckState.Checked) |
||||
allUnChecked = false; |
||||
else |
||||
allChecked = false; |
||||
} |
||||
|
||||
Debug.Assert(!(allChecked && allUnChecked)); |
||||
if (allChecked) |
||||
return CheckState.Checked; |
||||
else if (allUnChecked) |
||||
return CheckState.Unchecked; |
||||
else |
||||
return CheckState.Indeterminate; |
||||
} |
||||
} |
||||
} |
||||
#endregion
|
||||
|
||||
#region ParentsInHierarch
|
||||
/// <summary>
|
||||
/// Gets a collection of the parent of this item
|
||||
/// </summary>
|
||||
[Browsable(false)] |
||||
public TreeListViewItem[] ParentsInHierarch |
||||
{ |
||||
get |
||||
{ |
||||
TreeListViewItemCollection items = GetParentsInHierarch(); |
||||
return(items.ToArray()); |
||||
} |
||||
} |
||||
private TreeListViewItemCollection GetParentsInHierarch() |
||||
{ |
||||
TreeListViewItemCollection temp = Parent != null ? |
||||
Parent.GetParentsInHierarch() : new TreeListViewItemCollection(); |
||||
if(Parent != null) temp.Add(Parent); |
||||
return temp; |
||||
} |
||||
#endregion
|
||||
#region FullPath
|
||||
/// <summary>
|
||||
/// Gets the fullpath of an item (Parents.Text + \ + this.Text)
|
||||
/// </summary>
|
||||
[Browsable(false)] |
||||
public string FullPath |
||||
{ |
||||
get |
||||
{ |
||||
if(Parent != null) |
||||
{ |
||||
string pathSeparator = IsInATreeListView ? TreeListView.PathSeparator : "\\"; |
||||
string strPath = Parent.FullPath + pathSeparator + Text; |
||||
return(strPath.Replace(pathSeparator + pathSeparator, pathSeparator)); |
||||
} |
||||
else |
||||
return(Text); |
||||
} |
||||
} |
||||
#endregion
|
||||
#region Text
|
||||
/// <summary>
|
||||
/// Get or Set the Text property
|
||||
/// </summary>
|
||||
new public string Text |
||||
{ |
||||
get |
||||
{ |
||||
return(base.Text); |
||||
} |
||||
set |
||||
{ |
||||
base.Text = value; |
||||
TreeListViewItemCollection collection = Container; |
||||
if(collection != null) collection.Sort(false);} |
||||
} |
||||
#endregion
|
||||
#region Container
|
||||
/// <summary>
|
||||
/// Get the collection that contains this item
|
||||
/// </summary>
|
||||
public TreeListViewItemCollection Container |
||||
{ |
||||
get |
||||
{ |
||||
if(Parent != null) return(Parent.Items); |
||||
if(IsInATreeListView) return(TreeListView.Items); |
||||
return(null); |
||||
} |
||||
} |
||||
#endregion
|
||||
#region IsInATreeListView
|
||||
internal bool IsInATreeListView |
||||
{ |
||||
get |
||||
{ |
||||
return(TreeListView != null); |
||||
} |
||||
} |
||||
#endregion
|
||||
#region LastChildIndexInListView
|
||||
/// <summary>
|
||||
/// Get the biggest index in the listview of the visible childs of this item
|
||||
/// including this item
|
||||
/// </summary>
|
||||
[Browsable(false)] |
||||
public int LastChildIndexInListView |
||||
{ |
||||
get |
||||
{ |
||||
if(!IsInATreeListView) |
||||
throw(new Exception("No ListView control")); |
||||
int index = this.Index, temp; |
||||
foreach(TreeListViewItem item in Items) |
||||
if(item.Visible) |
||||
{ |
||||
temp = item.LastChildIndexInListView; |
||||
if(temp > index) index = temp; |
||||
} |
||||
return(index); |
||||
} |
||||
} |
||||
#endregion
|
||||
#region ChildrenCount
|
||||
/// <summary>
|
||||
/// Get the children count recursively
|
||||
/// </summary>
|
||||
[Browsable(false)] |
||||
public int ChildrenCount |
||||
{ |
||||
get |
||||
{ |
||||
TreeListViewItem[] items = _items.ToArray(); |
||||
int count = items.Length; |
||||
foreach(TreeListViewItem item in items) count += item.ChildrenCount; |
||||
return(count); |
||||
} |
||||
} |
||||
#endregion
|
||||
#region IsExpanded
|
||||
private bool _isexpanded; |
||||
/// <summary>
|
||||
/// Returns true if this item is expanded
|
||||
/// </summary>
|
||||
public bool IsExpanded |
||||
{ |
||||
get |
||||
{ |
||||
return(_isexpanded); |
||||
} |
||||
set |
||||
{ |
||||
if(_isexpanded == value) return; |
||||
if(value) Expand(); |
||||
else Collapse(); |
||||
} |
||||
} |
||||
#endregion
|
||||
#region Level
|
||||
/// <summary>
|
||||
/// Get the level of the item in the treelistview
|
||||
/// </summary>
|
||||
[Browsable(false)] |
||||
public int Level |
||||
{ |
||||
get |
||||
{ |
||||
return(Parent == null ? 0 : Parent.Level + 1); |
||||
} |
||||
} |
||||
#endregion
|
||||
#region Items
|
||||
private TreeListViewItemCollection _items; |
||||
/// <summary>
|
||||
/// Get the items contained in this item
|
||||
/// </summary>
|
||||
public TreeListViewItemCollection Items |
||||
{ |
||||
get |
||||
{ |
||||
return(_items); |
||||
} |
||||
} |
||||
#endregion
|
||||
#region Parent
|
||||
private TreeListViewItem _parent; |
||||
/// <summary>
|
||||
/// Get the parent of this item
|
||||
/// </summary>
|
||||
public TreeListViewItem Parent |
||||
{ |
||||
get |
||||
{ |
||||
return(_parent); |
||||
} |
||||
} |
||||
#endregion
|
||||
#region TreeListView
|
||||
/// <summary>
|
||||
/// Gets the TreeListView containing this item
|
||||
/// </summary>
|
||||
public new TreeListView ListView |
||||
{ |
||||
get |
||||
{ |
||||
if(base.ListView != null) return((TreeListView) base.ListView); |
||||
if(Parent != null) return(Parent.ListView); |
||||
return(null); |
||||
} |
||||
} |
||||
/// <summary>
|
||||
/// Gets the TreeListView containing this item
|
||||
/// </summary>
|
||||
public TreeListView TreeListView |
||||
{ |
||||
get |
||||
{ |
||||
return (TreeListView) ListView; |
||||
} |
||||
} |
||||
#endregion
|
||||
#region Visible
|
||||
/// <summary>
|
||||
/// Returns true if this item is visible in the TreeListView
|
||||
/// </summary>
|
||||
public bool Visible |
||||
{ |
||||
get |
||||
{ |
||||
return(base.Index > -1); |
||||
} |
||||
} |
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
/// <summary>
|
||||
/// Create a new instance of a TreeListViewItem
|
||||
/// </summary>
|
||||
public TreeListViewItem() |
||||
{ |
||||
_items = new TreeListViewItemCollection(this); |
||||
} |
||||
/// <summary>
|
||||
/// Create a new instance of a TreeListViewItem
|
||||
/// </summary>
|
||||
public TreeListViewItem(string value) : this() |
||||
{ |
||||
this.Text = value; |
||||
} |
||||
/// <summary>
|
||||
/// Create a new instance of a TreeListViewItem
|
||||
/// </summary>
|
||||
public TreeListViewItem(string value, int imageindex) : this(value) |
||||
{ |
||||
this.ImageIndex = imageindex; |
||||
} |
||||
#endregion
|
||||
|
||||
#region Functions
|
||||
internal void GetCheckedItems(ref TreeListViewItemCollection items) |
||||
{ |
||||
if(Checked) items.Add(this); |
||||
foreach(TreeListViewItem item in Items) |
||||
item.GetCheckedItems(ref items); |
||||
} |
||||
/// <summary>
|
||||
/// Places the subitem into edit mode
|
||||
/// </summary>
|
||||
/// <param name="column">Number of the subitem to edit</param>
|
||||
public void BeginEdit(int column) |
||||
{ |
||||
if(TreeListView == null) |
||||
throw(new Exception("The item is not associated with a TreeListView")); |
||||
if(!TreeListView.Visible) |
||||
throw(new Exception("The item is not visible")); |
||||
if(column + 1 > TreeListView.Columns.Count) |
||||
throw(new Exception("The column is greater the number of columns in the TreeListView")); |
||||
TreeListView.Focus(); |
||||
Focused = true; |
||||
TreeListView._lastitemclicked = new EditItemInformations(this, column, this.SubItems[column].Text); |
||||
base.BeginEdit(); |
||||
} |
||||
/// <summary>
|
||||
/// Places the item into edit mode
|
||||
/// </summary>
|
||||
new public void BeginEdit() |
||||
{ |
||||
BeginEdit(0); |
||||
} |
||||
/// <summary>
|
||||
/// Asks the associated TreeListView control to redraw this item
|
||||
/// </summary>
|
||||
public void Redraw() |
||||
{ |
||||
if(ListView == null || !Visible) return; |
||||
try |
||||
{ |
||||
APIsUser32.SendMessage( |
||||
ListView.Handle, |
||||
(int)APIsEnums.ListViewMessages.REDRAWITEMS, |
||||
Index, Index);} |
||||
catch{} |
||||
} |
||||
/// <summary>
|
||||
/// Retrieves the specified portion of the bounding rectangle for the item
|
||||
/// </summary>
|
||||
/// <param name="portion">One of the TreeListViewItemBoundsPortion values that represents a portion of the item for which to retrieve the bounding rectangle</param>
|
||||
/// <returns>A Rectangle that represents the bounding rectangle for the specified portion of the item</returns>
|
||||
public Rectangle GetBounds(TreeListViewItemBoundsPortion portion) |
||||
{ |
||||
switch((int)portion) |
||||
{ |
||||
case (int) TreeListViewItemBoundsPortion.PlusMinus: |
||||
if(TreeListView == null) |
||||
throw(new Exception("This item is not associated with a TreeListView control")); |
||||
Point pos = base.GetBounds(ItemBoundsPortion.Entire).Location; |
||||
Point position = new Point( |
||||
Level*SystemInformation.SmallIconSize.Width + 1 + pos.X, |
||||
TreeListView.GetItemRect(Index, ItemBoundsPortion.Entire).Top + 1); |
||||
return new Rectangle(position, TreeListView.ShowPlusMinus ? SystemInformation.SmallIconSize : new Size(0, 0)); |
||||
default: |
||||
ItemBoundsPortion lviPortion = (ItemBoundsPortion)(int) portion; |
||||
return base.GetBounds(lviPortion); |
||||
} |
||||
} |
||||
internal void SetParent(TreeListViewItem parent) |
||||
{ |
||||
_parent = parent; |
||||
} |
||||
/// <summary>
|
||||
/// Remove this item from its associated collection
|
||||
/// </summary>
|
||||
public new void Remove() |
||||
{ |
||||
if(ListView != null) |
||||
if(ListView.InvokeRequired) |
||||
throw(new Exception("Invoke required")); |
||||
TreeListViewItemCollection collection = this.Container; |
||||
if(collection != null) collection.Remove(this); |
||||
} |
||||
/// <summary>
|
||||
/// Check if this node is one of the parents of an item (recursively)
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <returns></returns>
|
||||
public bool IsAParentOf(TreeListViewItem item) |
||||
{ |
||||
TreeListViewItem[] parents = item.ParentsInHierarch; |
||||
foreach(TreeListViewItem parent in parents) |
||||
if(parent == this) return(true); |
||||
return(false); |
||||
} |
||||
/// <summary>
|
||||
/// Ensure that the node is visible (expand parents and scroll listview so that the item is visible)
|
||||
/// </summary>
|
||||
new public void EnsureVisible() |
||||
{ |
||||
if(!Visible) |
||||
{ |
||||
if(IsInATreeListView) |
||||
TreeListView.BeginUpdate(); |
||||
if(ListView != null) |
||||
ListView.Invoke(new MethodInvoker(ExpandParents)); |
||||
else ExpandParents(); |
||||
if(TreeListView != null) |
||||
TreeListView.EndUpdate(); |
||||
} |
||||
base.EnsureVisible(); |
||||
} |
||||
internal void ExpandParents() |
||||
{ |
||||
if(IsInATreeListView) |
||||
Debug.Assert(!ListView.InvokeRequired); |
||||
if(Parent != null) |
||||
{ |
||||
if(!Parent.IsExpanded) Parent.ExpandInternal(); |
||||
Parent.ExpandParents(); |
||||
} |
||||
} |
||||
#endregion
|
||||
#region Indentation
|
||||
/// <summary>
|
||||
/// Set the indentation using the level of this item
|
||||
/// </summary>
|
||||
/// <returns>True if successfull, false otherwise</returns>
|
||||
public bool SetIndentation() |
||||
{ |
||||
if(!IsInATreeListView) return false; |
||||
bool res = true; |
||||
APIsStructs.LV_ITEM lvi = new APIsStructs.LV_ITEM(); |
||||
lvi.iItem = Index; |
||||
lvi.iIndent = Level; |
||||
if(TreeListView.ShowPlusMinus) lvi.iIndent++; |
||||
lvi.mask = APIsEnums.ListViewItemFlags.INDENT; |
||||
try |
||||
{ |
||||
APIsUser32.SendMessage( |
||||
ListView.Handle, |
||||
APIsEnums.ListViewMessages.SETITEM, |
||||
0, |
||||
ref lvi); |
||||
} |
||||
catch |
||||
{ |
||||
res = false; |
||||
} |
||||
return res; |
||||
} |
||||
/// <summary>
|
||||
/// Refresh indentation of this item and of its children (recursively)
|
||||
/// </summary>
|
||||
/// <param name="recursively">Recursively</param>
|
||||
public void RefreshIndentation(bool recursively) |
||||
{ |
||||
if(ListView == null) return; |
||||
if(ListView.InvokeRequired) |
||||
throw(new Exception("Invoke Required")); |
||||
if(!this.Visible) return; |
||||
SetIndentation(); |
||||
if(recursively) |
||||
{ |
||||
try |
||||
{ |
||||
foreach(TreeListViewItem item in this.Items) |
||||
item.RefreshIndentation(true); |
||||
} |
||||
catch{} |
||||
} |
||||
} |
||||
#endregion
|
||||
#region Expand
|
||||
/// <summary>
|
||||
/// Expand
|
||||
/// </summary>
|
||||
public void Expand() |
||||
{ |
||||
if(IsInATreeListView) |
||||
if (ListView.InvokeRequired) |
||||
throw(new Exception("Invoke Required")); |
||||
if(TreeListView != null) TreeListView.BeginUpdate(); |
||||
ExpandInternal(); |
||||
if(TreeListView != null) TreeListView.EndUpdate(); |
||||
} |
||||
internal void ExpandInternal() |
||||
{ |
||||
if(IsInATreeListView) |
||||
if (ListView.InvokeRequired) |
||||
throw(new Exception("Invoke Required")); |
||||
|
||||
TreeListViewItem selItem = null; |
||||
if(TreeListView != null) selItem = TreeListView.FocusedItem; |
||||
|
||||
// Must set ListView.checkDirection to CheckDirection.None.
|
||||
// Forbid recursively checking.
|
||||
CheckDirection oldDirection = CheckDirection.All; |
||||
if(ListView != null) |
||||
{ |
||||
oldDirection = ListView._checkDirection; |
||||
ListView._checkDirection = CheckDirection.None; |
||||
} |
||||
|
||||
// The item wasn't expanded -> raise an event
|
||||
if(Visible && !_isexpanded && ListView != null) |
||||
{ |
||||
TreeListViewCancelEventArgs e = new TreeListViewCancelEventArgs( |
||||
this, TreeListViewAction.Expand); |
||||
ListView.RaiseBeforeExpand(e); |
||||
if(e.Cancel) return; |
||||
} |
||||
|
||||
if(Visible) |
||||
for(int i = Items.Count - 1 ; i >= 0 ;i--) |
||||
{ |
||||
TreeListViewItem item = this.Items[i]; |
||||
if(!item.Visible) |
||||
{ |
||||
ListView LView = this.ListView; |
||||
LView.Items.Insert( |
||||
this.Index + 1, item); |
||||
item.SetIndentation(); |
||||
} |
||||
if(item.IsExpanded) item.Expand(); |
||||
} |
||||
// The item wasn't expanded -> raise an event
|
||||
if(Visible && !_isexpanded && IsInATreeListView) |
||||
{ |
||||
this._isexpanded = true; |
||||
TreeListViewEventArgs e = new TreeListViewEventArgs( |
||||
this, TreeListViewAction.Expand); |
||||
ListView.RaiseAfterExpand(e); |
||||
if (AfterExpand != null) AfterExpand(this); |
||||
} |
||||
this._isexpanded = true; |
||||
|
||||
// Reset ListView.checkDirection
|
||||
if(IsInATreeListView) |
||||
ListView._checkDirection = oldDirection; |
||||
if(TreeListView != null && selItem != null) |
||||
if(selItem.Visible) |
||||
selItem.Focused = true; |
||||
} |
||||
/// <summary>
|
||||
/// Expand all sub nodes
|
||||
/// </summary>
|
||||
public void ExpandAll() |
||||
{ |
||||
if(IsInATreeListView) |
||||
if(ListView.InvokeRequired) |
||||
throw(new Exception("Invoke Required")); |
||||
if(TreeListView != null) TreeListView.BeginUpdate(); |
||||
ExpandAllInternal(); |
||||
if(TreeListView != null) TreeListView.EndUpdate(); |
||||
} |
||||
internal void ExpandAllInternal() |
||||
{ |
||||
if(IsInATreeListView) |
||||
if(ListView.InvokeRequired) |
||||
throw(new Exception("Invoke Required")); |
||||
ExpandInternal(); |
||||
// Expand canceled -> stop expandall for the children of this item
|
||||
if(!IsExpanded) return; |
||||
for(int i = 0 ; i < Items.Count ; i++) |
||||
Items[i].ExpandAllInternal(); |
||||
} |
||||
#endregion
|
||||
#region Collapse
|
||||
/// <summary>
|
||||
/// Collapse
|
||||
/// </summary>
|
||||
public void Collapse() |
||||
{ |
||||
if(IsInATreeListView) |
||||
if(ListView.InvokeRequired) |
||||
throw(new Exception("Invoke Required")); |
||||
if(TreeListView != null) TreeListView.BeginUpdate(); |
||||
CollapseInternal(); |
||||
if(TreeListView != null) TreeListView.EndUpdate(); |
||||
} |
||||
internal void CollapseInternal() |
||||
{ |
||||
if(IsInATreeListView) |
||||
if(ListView.InvokeRequired) |
||||
throw(new Exception("Invoke Required")); |
||||
TreeListViewItem selItem = null; |
||||
if(TreeListView != null) selItem = TreeListView.FocusedItem; |
||||
// The item was expanded -> raise an event
|
||||
if(Visible && _isexpanded && ListView != null) |
||||
{ |
||||
TreeListViewCancelEventArgs e = new TreeListViewCancelEventArgs( |
||||
this, TreeListViewAction.Collapse); |
||||
ListView.RaiseBeforeCollapse(e); |
||||
if(e.Cancel) return; |
||||
} |
||||
|
||||
// Collapse
|
||||
if(this.Visible) |
||||
foreach(TreeListViewItem item in Items) |
||||
item.Hide(); |
||||
|
||||
// The item was expanded -> raise an event
|
||||
if(Visible && _isexpanded && IsInATreeListView) |
||||
{ |
||||
this._isexpanded = false; |
||||
TreeListViewEventArgs e = new TreeListViewEventArgs( |
||||
this, TreeListViewAction.Collapse); |
||||
ListView.RaiseAfterCollapse(e); |
||||
if(AfterCollapse != null) AfterCollapse(this); |
||||
} |
||||
this._isexpanded = false; |
||||
if(IsInATreeListView && selItem != null) |
||||
{ |
||||
if(selItem.Visible) |
||||
selItem.Focused = true; |
||||
else |
||||
{ |
||||
ListView listview = (ListView) TreeListView; |
||||
listview.SelectedItems.Clear(); |
||||
TreeListViewItem[] items = selItem.ParentsInHierarch; |
||||
for(int i = items.Length - 1; i >= 0; i--) |
||||
if(items[i].Visible) |
||||
{ |
||||
items[i].Focused = true; |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
/// <summary>
|
||||
/// Collapse all sub nodes
|
||||
/// </summary>
|
||||
public void CollapseAll() |
||||
{ |
||||
if(IsInATreeListView) |
||||
if(ListView.InvokeRequired) |
||||
throw(new Exception("Invoke Required")); |
||||
if(TreeListView != null) TreeListView.BeginUpdate(); |
||||
CollapseAllInternal(); |
||||
if(TreeListView != null) TreeListView.EndUpdate(); |
||||
} |
||||
internal void CollapseAllInternal() |
||||
{ |
||||
if(IsInATreeListView) |
||||
if(ListView.InvokeRequired) |
||||
throw(new Exception("Invoke Required")); |
||||
foreach(TreeListViewItem item in this.Items) |
||||
item.CollapseAllInternal(); |
||||
CollapseInternal(); |
||||
} |
||||
/// <summary>
|
||||
/// Hide this node (remove from TreeListView but
|
||||
/// not from associated Parent items)
|
||||
/// </summary>
|
||||
internal void Hide() |
||||
{ |
||||
if(IsInATreeListView) |
||||
if(ListView.InvokeRequired) |
||||
throw(new Exception("Invoke Required")); |
||||
foreach(TreeListViewItem item in Items) item.Hide(); |
||||
if(Visible) base.Remove(); |
||||
Selected = false; |
||||
} |
||||
#endregion
|
||||
|
||||
#region DrawPlusMinus
|
||||
internal void DrawPlusMinus() |
||||
{ |
||||
if(!IsInATreeListView) return; |
||||
if(TreeListView._updating) return; |
||||
Graphics g = Graphics.FromHwnd(TreeListView.Handle); |
||||
DrawPlusMinus(g); |
||||
g.Dispose(); |
||||
} |
||||
internal void DrawPlusMinus(Graphics g) |
||||
{ |
||||
if(!IsInATreeListView) return; |
||||
if(TreeListView._updating) return; |
||||
Debug.Assert(!TreeListView.InvokeRequired); |
||||
if(Items.Count == 0 || TreeListView.Columns.Count == 0) return; |
||||
Drawing.Imaging.ImageAttributes attr = new Drawing.Imaging.ImageAttributes(); |
||||
attr.SetColorKey(Color.Transparent, Color.Transparent); |
||||
if(TreeListView.Columns[0].Width > (Level + 1) * SystemInformation.SmallIconSize.Width) |
||||
g.DrawImage( |
||||
TreeListView.plusMinusImageList.Images[IsExpanded ? 1 : 0], |
||||
GetBounds(TreeListViewItemBoundsPortion.PlusMinus), |
||||
0, 0, SystemInformation.SmallIconSize.Width, SystemInformation.SmallIconSize.Height, |
||||
GraphicsUnit.Pixel, attr); |
||||
attr.Dispose(); |
||||
} |
||||
#endregion
|
||||
#region DrawPlusMinusLines
|
||||
internal void DrawPlusMinusLines() |
||||
{ |
||||
if(!IsInATreeListView) return; |
||||
if(TreeListView._updating) return; |
||||
Graphics g = Graphics.FromHwnd(TreeListView.Handle); |
||||
DrawPlusMinusLines(g); |
||||
g.Dispose(); |
||||
} |
||||
internal void DrawPlusMinusLines(Graphics g) |
||||
{ |
||||
if(!IsInATreeListView) return; |
||||
if(TreeListView._updating) return; |
||||
Debug.Assert(!TreeListView.InvokeRequired); |
||||
if(!TreeListView.ShowPlusMinus || TreeListView.Columns.Count == 0) return; |
||||
int itemLevel = Level; |
||||
Rectangle plusminusRect = GetBounds(TreeListViewItemBoundsPortion.PlusMinus); |
||||
Rectangle entireRect = GetBounds(TreeListViewItemBoundsPortion.Entire); |
||||
Drawing.Drawing2D.HatchBrush hb = new Drawing.Drawing2D.HatchBrush(Drawing.Drawing2D.HatchStyle.Percent50, TreeListView.PlusMinusLineColor, BackColor); |
||||
Pen pen = new Pen(hb); |
||||
Point point1, point2; |
||||
#region Vertical line
|
||||
point1 = new Point( |
||||
plusminusRect.Right - SystemInformation.SmallIconSize.Width / 2 - 1, |
||||
entireRect.Top); |
||||
point2 = new Point( point1.X, entireRect.Bottom); |
||||
// If ListView has no items that have the same level before this item
|
||||
if(!HasLevelBeforeItem(itemLevel)) point1.Y += SystemInformation.SmallIconSize.Height / 2; |
||||
// If ListView has no items that have the same level after this item
|
||||
if(!HasLevelAfterItem(itemLevel)) point2.Y -= SystemInformation.SmallIconSize.Height / 2 + 1; |
||||
if(TreeListView.Columns[0].Width > (Level + 1) * SystemInformation.SmallIconSize.Width) |
||||
g.DrawLine(pen, point1, point2); |
||||
#endregion
|
||||
#region Horizontal line
|
||||
point1 = new Point( |
||||
plusminusRect.Right - SystemInformation.SmallIconSize.Width / 2 - 1, |
||||
GetBounds(TreeListViewItemBoundsPortion.Entire).Top + SystemInformation.SmallIconSize.Height /2); |
||||
point2 = new Point(plusminusRect.Right + 1, point1.Y); |
||||
if(TreeListView.Columns[0].Width > (Level + 1) * SystemInformation.SmallIconSize.Width) |
||||
g.DrawLine(pen, point1, point2); |
||||
#endregion
|
||||
#region Lower Level lines
|
||||
for(int level = Level - 1; level > -1; level--) |
||||
if(HasLevelAfterItem(level)) |
||||
{ |
||||
point1 = new Point( |
||||
SystemInformation.SmallIconSize.Width * (2*level + 1) / 2 + entireRect.X, |
||||
entireRect.Top); |
||||
point2 = new Point( |
||||
point1.X, entireRect.Bottom); |
||||
if(TreeListView.Columns[0].Width > (level + 1) * SystemInformation.SmallIconSize.Width) |
||||
g.DrawLine(pen, point1, point2); |
||||
} |
||||
#endregion
|
||||
pen.Dispose(); |
||||
hb.Dispose(); |
||||
} |
||||
internal bool HasLevelAfterItem(int level) |
||||
{ |
||||
if(TreeListView == null) return false; |
||||
Debug.Assert(!TreeListView.InvokeRequired); |
||||
int lev = Level, tempLevel; |
||||
ListView listview = (ListView) TreeListView; |
||||
for(int i = Index + 1; i < listview.Items.Count; i++) |
||||
{ |
||||
tempLevel = ((TreeListViewItem)listview.Items[i]).Level; |
||||
if(tempLevel == level) return true; |
||||
if(tempLevel < level) return false; |
||||
} |
||||
return false; |
||||
} |
||||
internal bool HasLevelBeforeItem(int level) |
||||
{ |
||||
if(TreeListView == null) return false; |
||||
Debug.Assert(!TreeListView.InvokeRequired); |
||||
int lev = Level, tempLevel; |
||||
ListView listview = (ListView) TreeListView; |
||||
for(int i = Index - 1; i > -1; i--) |
||||
{ |
||||
tempLevel = ((TreeListViewItem)listview.Items[i]).Level; |
||||
if(tempLevel <= level) return true; |
||||
} |
||||
return false; |
||||
} |
||||
#endregion
|
||||
#region DrawFocusCues
|
||||
internal void DrawFocusCues() |
||||
{ |
||||
if(!IsInATreeListView) return; |
||||
if(TreeListView._updating) return; |
||||
if(TreeListView.HideSelection && !TreeListView.Focused) return; |
||||
Graphics g = Graphics.FromHwnd(TreeListView.Handle); |
||||
if(Visible) |
||||
{ |
||||
Rectangle entireitemrect = GetBounds(ItemBoundsPortion.Entire); |
||||
if(entireitemrect.Bottom > entireitemrect.Height * 1.5f) |
||||
{ |
||||
Rectangle labelitemrect = GetBounds(ItemBoundsPortion.Label); |
||||
Rectangle itemonlyrect = GetBounds(ItemBoundsPortion.ItemOnly); |
||||
Rectangle selecteditemrect = new Rectangle( |
||||
labelitemrect.Left, |
||||
labelitemrect.Top, |
||||
TreeListView.FullRowSelect ? entireitemrect.Width - labelitemrect.Left - 1 : itemonlyrect.Width - SystemInformation.SmallIconSize.Width - 1, |
||||
labelitemrect.Height - 1); |
||||
Pen pen = new Pen(TreeListView.Focused && Selected ? Color.Blue : ColorUtil.CalculateColor(SystemColors.Highlight, SystemColors.Window, 130)); |
||||
for(int i = 1; i < TreeListView.Columns.Count; i++) |
||||
{ |
||||
Rectangle rect = TreeListView.GetSubItemRect(Index, i); |
||||
if(rect.X < selecteditemrect.X) |
||||
selecteditemrect = new Rectangle( |
||||
rect.X, selecteditemrect.Y, |
||||
selecteditemrect.Width + (selecteditemrect.X-rect.X), |
||||
selecteditemrect.Height); |
||||
} |
||||
g.DrawRectangle(new Pen(ColorUtil.VSNetSelectionColor), selecteditemrect); |
||||
// Fill the item (in CommCtl V6, the selection area is not always the same :
|
||||
// label only or first column). I decided to always draw the entire column...
|
||||
if(!TreeListView.FullRowSelect) |
||||
g.FillRectangle( |
||||
new SolidBrush(BackColor), |
||||
itemonlyrect.Right-1, itemonlyrect.Top, |
||||
labelitemrect.Width - itemonlyrect.Width + SystemInformation.SmallIconSize.Width + 1, selecteditemrect.Height + 1); |
||||
bool draw = true; |
||||
if(PrevVisibleItem != null) |
||||
if(PrevVisibleItem.Selected) draw = false; |
||||
// Draw upper line if previous item is not selected
|
||||
if(draw) g.DrawLine(pen, selecteditemrect.Left, selecteditemrect.Top, selecteditemrect.Right, selecteditemrect.Top); |
||||
g.DrawLine(pen, selecteditemrect.Left, selecteditemrect.Top, selecteditemrect.Left, selecteditemrect.Bottom); |
||||
draw = true; |
||||
if(NextVisibleItem != null) |
||||
if(NextVisibleItem.Selected) draw = false; |
||||
// Draw lower line if net item is not selected
|
||||
if(draw) g.DrawLine(pen, selecteditemrect.Left, selecteditemrect.Bottom, selecteditemrect.Right, selecteditemrect.Bottom); |
||||
g.DrawLine(pen, selecteditemrect.Right, selecteditemrect.Top, selecteditemrect.Right, selecteditemrect.Bottom); |
||||
// If FullRowSelect is false and multiselect is enabled, the items don't have the same width
|
||||
if(!TreeListView.FullRowSelect && NextVisibleItem != null) |
||||
if(NextVisibleItem.Selected) |
||||
{ |
||||
int nextItemWidth = NextVisibleItem.GetBounds(TreeListViewItemBoundsPortion.ItemOnly).Width; |
||||
if(nextItemWidth != itemonlyrect.Width) |
||||
{ |
||||
g.DrawLine( |
||||
pen, |
||||
selecteditemrect.Right, |
||||
selecteditemrect.Bottom, |
||||
selecteditemrect.Right - (itemonlyrect.Width-nextItemWidth), |
||||
selecteditemrect.Bottom); |
||||
} |
||||
} |
||||
pen.Dispose(); |
||||
} |
||||
} |
||||
g.Dispose(); |
||||
} |
||||
#endregion
|
||||
#region DrawIntermediateState
|
||||
internal void DrawIntermediateState() |
||||
{ |
||||
if(!IsInATreeListView) return; |
||||
if(TreeListView._updating) return; |
||||
Graphics g = Graphics.FromHwnd(TreeListView.Handle); |
||||
DrawIntermediateState(g); |
||||
g.Dispose(); |
||||
} |
||||
internal void DrawIntermediateState(Graphics g) |
||||
{ |
||||
if(!IsInATreeListView) return; |
||||
if(TreeListView._updating) return; |
||||
Debug.Assert(!TreeListView.InvokeRequired); |
||||
if(TreeListView.CheckBoxes != CheckBoxesTypes.Recursive || TreeListView.Columns.Count == 0) return; |
||||
if(CheckStatus == CheckState.Indeterminate) |
||||
{ |
||||
Rectangle rect = GetBounds(ItemBoundsPortion.Icon); |
||||
Rectangle r = TreeListView._comctl32Version >= 6 ? |
||||
new Rectangle(rect.Left - 14, rect.Top + 5, rect.Height-10, rect.Height-10) : |
||||
new Rectangle(rect.Left - 11, rect.Top + 5, rect.Height-10, rect.Height-10); |
||||
Brush brush = new Drawing.Drawing2D.LinearGradientBrush(r, Color.Gray, Color.LightBlue, 45, false); |
||||
if(TreeListView.Columns[0].Width > (Level + (TreeListView.ShowPlusMinus?2:1)) * SystemInformation.SmallIconSize.Width) |
||||
g.FillRectangle(brush, r); |
||||
brush.Dispose(); |
||||
} |
||||
} |
||||
#endregion
|
||||
} |
||||
} |
@ -1,611 +0,0 @@
@@ -1,611 +0,0 @@
|
||||
using System; |
||||
using System.Collections; |
||||
using System.ComponentModel; |
||||
|
||||
namespace System.Windows.Forms |
||||
{ |
||||
/// <summary>
|
||||
/// Represents the collection of items in a TreeListView control or in a TreeListViewItem
|
||||
/// </summary>
|
||||
public class TreeListViewItemCollection : CollectionBase |
||||
{ |
||||
/// <summary>
|
||||
/// Comparer for TreeListViewItem
|
||||
/// </summary>
|
||||
public class TreeListViewItemCollectionComparer : ITreeListViewItemComparer |
||||
{ |
||||
#region Order Property
|
||||
private SortOrder _sortorder = SortOrder.Ascending; |
||||
/// <summary>
|
||||
/// Sort order
|
||||
/// </summary>
|
||||
public SortOrder SortOrder |
||||
{ |
||||
get{return(_sortorder);} |
||||
set{_sortorder = value;} |
||||
} |
||||
private int _column; |
||||
/// <summary>
|
||||
/// Column for the comparison
|
||||
/// </summary>
|
||||
public int Column |
||||
{ |
||||
get{return(_column);} |
||||
set{_column = value;} |
||||
} |
||||
#endregion
|
||||
#region Constructor
|
||||
/// <summary>
|
||||
/// Create a new instance of Comparer
|
||||
/// </summary>
|
||||
public TreeListViewItemCollectionComparer() : this(SortOrder.Ascending, 0) |
||||
{} |
||||
/// <summary>
|
||||
/// Create a new instance of Comparer
|
||||
/// </summary>
|
||||
/// <param name="order"></param>
|
||||
public TreeListViewItemCollectionComparer(SortOrder order) : this(order, 0) |
||||
{ |
||||
SortOrder = order; |
||||
} |
||||
/// <summary>
|
||||
/// Create a new instance of Comparer
|
||||
/// </summary>
|
||||
/// <param name="order"></param>
|
||||
/// <param name="column"></param>
|
||||
public TreeListViewItemCollectionComparer(SortOrder order, int column) |
||||
{ |
||||
SortOrder = order; |
||||
_column = column; |
||||
} |
||||
#endregion
|
||||
#region Compare
|
||||
/// <summary>
|
||||
/// Compare two TreeListViewItems
|
||||
/// </summary>
|
||||
/// <param name="x"></param>
|
||||
/// <param name="y"></param>
|
||||
/// <returns></returns>
|
||||
public int Compare(object x, object y) |
||||
{ |
||||
TreeListViewItem a = (TreeListViewItem) x; |
||||
TreeListViewItem b = (TreeListViewItem) y; |
||||
int res = 1; |
||||
if(Column < a.SubItems.Count && Column < b.SubItems.Count) |
||||
res = string.CompareOrdinal(a.SubItems[Column].Text.ToUpper(), b.SubItems[Column].Text.ToUpper()); |
||||
switch(SortOrder) |
||||
{ |
||||
case SortOrder.Ascending: |
||||
return(res); |
||||
case SortOrder.Descending: |
||||
return(-res); |
||||
default: |
||||
return(1); |
||||
} |
||||
} |
||||
#endregion
|
||||
} |
||||
#region Private delegates
|
||||
private delegate void VoidHandlerSortOrder(SortOrder value); |
||||
private delegate void VoidHandler(); |
||||
private delegate void ChangeChildrenCheckStateRecursivelyHandler(CheckState state); |
||||
private delegate TreeListViewItemCollection GetCollectionHandler(); |
||||
private delegate string GetStringHandler(); |
||||
private delegate int GetIntHandler(); |
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
#region Sortable
|
||||
private bool _sortable = true; |
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether the items of the collection can be reorder while the sort function is being called
|
||||
/// </summary>
|
||||
public bool Sortable |
||||
{ |
||||
get |
||||
{ |
||||
return _sortable; |
||||
} |
||||
set |
||||
{ |
||||
_sortable = value; |
||||
} |
||||
} |
||||
#endregion
|
||||
#region SortOrder
|
||||
/// <summary>
|
||||
/// Get or set the new sortorder (apply automatically the sort function
|
||||
/// if the sortorder value is changed)
|
||||
/// </summary>
|
||||
public SortOrder SortOrder |
||||
{ |
||||
get{return(Comparer.SortOrder);} |
||||
set{Comparer.SortOrder = value; |
||||
Sort(false);} |
||||
} |
||||
#endregion
|
||||
#region Comparer
|
||||
private ITreeListViewItemComparer _comparer = new TreeListViewItemCollectionComparer(SortOrder.Ascending); |
||||
/// <summary>
|
||||
/// Gets the comparer used in the Sort and Add functions
|
||||
/// </summary>
|
||||
public ITreeListViewItemComparer Comparer |
||||
{ |
||||
get{return(_comparer);} |
||||
set{_comparer = value;} |
||||
} |
||||
#endregion
|
||||
#region SortOrderRecursively
|
||||
/// <summary>
|
||||
/// Set the new sortorder (apply automatically the sort function
|
||||
/// if the sortorder value is changed) for each collection recursively
|
||||
/// </summary>
|
||||
public SortOrder SortOrderRecursively |
||||
{ |
||||
set |
||||
{ |
||||
if(TreeListView != null) |
||||
if(TreeListView.InvokeRequired) |
||||
{ |
||||
TreeListView.Invoke(new VoidHandlerSortOrder(SetSortOrderRecursively), new object[] {value}); |
||||
return; |
||||
} |
||||
SetSortOrderRecursively(value); |
||||
} |
||||
} |
||||
private void SetSortOrderRecursively(SortOrder value) |
||||
{ |
||||
SortOrder = value; |
||||
foreach(TreeListViewItem item in this) |
||||
item.Items.SortOrderRecursively = value; |
||||
} |
||||
internal SortOrder SortOrderRecursivelyWithoutSort |
||||
{ |
||||
set{if(TreeListView != null) |
||||
if(TreeListView.InvokeRequired) |
||||
throw(new Exception("Invoke Required")); |
||||
Comparer.SortOrder = value; |
||||
foreach(TreeListViewItem item in this) |
||||
item.Items.SortOrderRecursivelyWithoutSort = value;} |
||||
} |
||||
#endregion
|
||||
#region Owner
|
||||
private TreeListView _owner; |
||||
/// <summary>
|
||||
/// TreeListView control that directly contains this collection
|
||||
/// </summary>
|
||||
public TreeListView Owner{get{return(_owner);}} |
||||
#endregion
|
||||
#region Parent
|
||||
private TreeListViewItem _parent; |
||||
/// <summary>
|
||||
/// TreeListViewItem that contains this collection
|
||||
/// </summary>
|
||||
public TreeListViewItem Parent{get{return(_parent);}} |
||||
#endregion
|
||||
#region TreeListView
|
||||
/// <summary>
|
||||
/// Returns the TreeListView set in Owner or in Parent
|
||||
/// </summary>
|
||||
private TreeListView TreeListView |
||||
{ |
||||
get |
||||
{ |
||||
if(Owner != null) return(Owner); |
||||
if(Parent != null) return(Parent.ListView); |
||||
return(null); |
||||
} |
||||
} |
||||
#endregion
|
||||
#region this[]
|
||||
/// <summary>
|
||||
/// Get an item in the collection
|
||||
/// </summary>
|
||||
public virtual TreeListViewItem this[int index] |
||||
{ |
||||
get |
||||
{ |
||||
return((TreeListViewItem) this.List[index]);} |
||||
} |
||||
#endregion
|
||||
#endregion
|
||||
#region Events, Delegates, and internal calls
|
||||
#region Events
|
||||
/// <summary>
|
||||
/// Occurs when an item is added to the collection
|
||||
/// </summary>
|
||||
[Description("Occurs when an item is added to the collection.")] |
||||
public TreeListViewEventHandler ItemAdded; |
||||
/// <summary>
|
||||
/// Occurs when an item is removed from the collection
|
||||
/// </summary>
|
||||
[Description("Occurs when an item is removed from the collection.")] |
||||
public TreeListViewEventHandler ItemRemoved; |
||||
#endregion
|
||||
#region On???
|
||||
/// <summary>
|
||||
/// Raises the ItemAdded event
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected virtual void OnItemAdded(TreeListViewEventArgs e) |
||||
{ |
||||
if(ItemAdded != null) ItemAdded(this, e); |
||||
} |
||||
/// <summary>
|
||||
/// Raises the ItemRemoved event
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected virtual void OnItemRemoved(TreeListViewEventArgs e) |
||||
{ |
||||
if(ItemRemoved != null) ItemRemoved(this, e); |
||||
} |
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
/// <summary>
|
||||
/// Create a collection in the root of a TreeListView (first level items)
|
||||
/// </summary>
|
||||
/// <param name="owner"></param>
|
||||
public TreeListViewItemCollection(TreeListView owner) |
||||
{ |
||||
_owner = owner; |
||||
} |
||||
/// <summary>
|
||||
/// Create a collection within a TreeListViewItem
|
||||
/// </summary>
|
||||
/// <param name="parent"></param>
|
||||
public TreeListViewItemCollection(TreeListViewItem parent) |
||||
{ |
||||
_parent = parent; |
||||
} |
||||
/// <summary>
|
||||
/// Create a free TreeListViewItemCollection (items will not be
|
||||
/// displayed in a TreeListView
|
||||
/// </summary>
|
||||
public TreeListViewItemCollection() |
||||
{ |
||||
} |
||||
#endregion
|
||||
|
||||
#region Sort Functions
|
||||
/// <summary>
|
||||
/// Transforms the collection to an array
|
||||
/// </summary>
|
||||
public TreeListViewItem[] ToArray() |
||||
{ |
||||
if(TreeListView != null) |
||||
if(TreeListView.InvokeRequired) |
||||
throw(new Exception("Invoke required")); |
||||
int size = this.Count; |
||||
TreeListViewItem[] eltsArray = new TreeListViewItem[size]; |
||||
for(int i = 0 ; i < size ; i++) |
||||
eltsArray[i] = this[i]; |
||||
return(eltsArray); |
||||
} |
||||
/// <summary>
|
||||
/// Sort the items in this collection (recursively or not)
|
||||
/// </summary>
|
||||
/// <param name="recursively">Recursively</param>
|
||||
public void Sort(bool recursively) |
||||
{ |
||||
if(TreeListView != null) TreeListView.BeginUpdate(); |
||||
SortInternal(recursively); |
||||
if(TreeListView != null) TreeListView.EndUpdate(); |
||||
} |
||||
internal void SortInternal(bool recursively) |
||||
{ |
||||
if(TreeListView != null) |
||||
if(TreeListView.InvokeRequired) |
||||
throw(new Exception("Invoke required")); |
||||
if(_sortable) |
||||
{ |
||||
// Gets an array of the items
|
||||
TreeListViewItem[] thisarray = ToArray(); |
||||
// Removes the items
|
||||
ClearInternal(); |
||||
// Adds the items
|
||||
foreach(TreeListViewItem item in thisarray) |
||||
Add(item); |
||||
} |
||||
if(recursively) |
||||
foreach(TreeListViewItem item in this) |
||||
item.Items.SortInternal(true); |
||||
} |
||||
#endregion
|
||||
#region Add Function
|
||||
/// <summary>
|
||||
/// Returns true if this collection contains an item
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool Contains(TreeListViewItem item) |
||||
{ |
||||
if(TreeListView != null) |
||||
if(TreeListView.InvokeRequired) |
||||
throw(new Exception("Invoke required")); |
||||
bool res = false; |
||||
foreach(TreeListViewItem elt in this) |
||||
if(item == elt) |
||||
{ |
||||
res = true; |
||||
break; |
||||
} |
||||
return(res); |
||||
} |
||||
private bool ListViewContains(TreeListViewItem item) |
||||
{ |
||||
if(TreeListView == null) return(false); |
||||
if(TreeListView.InvokeRequired) |
||||
throw(new Exception("Invoke required")); |
||||
ListView listview = (ListView) TreeListView; |
||||
ListViewItem listviewitem = (ListViewItem) item; |
||||
try{ |
||||
foreach(ListViewItem temp in listview.Items) |
||||
if(temp == listviewitem) return(true);} |
||||
catch{} |
||||
return(false); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Insert an item in the specified index.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This method works only if no comparer or no sort order is defined.
|
||||
/// </remarks>
|
||||
/// <param name="item">The item to insert.</param>
|
||||
/// <param name="index">The position in which to insert the item.</param>
|
||||
public virtual void Insert(TreeListViewItem item, int index) |
||||
{ |
||||
if (this.Sortable && this.Comparer != null && this.Comparer.SortOrder != SortOrder.None) |
||||
{ |
||||
Add (item); |
||||
return; |
||||
} |
||||
|
||||
if(TreeListView != null) |
||||
if(TreeListView.InvokeRequired) |
||||
throw(new Exception("Invoke required")); |
||||
// Do not add the item if the collection owns a TreeListView recursively
|
||||
// and the item already owns a TreeListView
|
||||
if(TreeListView != null && item.ListView != null) |
||||
throw(new Exception("The Item is already in a TreeListView")); |
||||
if(index < 0) return; |
||||
if(Parent != null) item.SetParent(Parent); |
||||
item.Items.Comparer = this.Comparer; |
||||
// Insert in the ListView
|
||||
|
||||
ListView listview = (ListView) TreeListView; |
||||
listview.Items.Insert(index, (ListViewItem) item); |
||||
if(item.IsExpanded) item.Expand(); |
||||
item.SetIndentation(); |
||||
|
||||
// Insert in this collection
|
||||
List.Insert(index, item); |
||||
OnItemAdded(new TreeListViewEventArgs(item, TreeListViewAction.Unknown)); |
||||
if(Count == 1 && TreeListView != null && Parent != null) |
||||
if(Parent.Visible) Parent.Redraw(); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Adds an item in the collection and in the TreeListView
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <returns>Index of the item in the collection</returns>
|
||||
public virtual int Add(TreeListViewItem item) |
||||
{ |
||||
if(TreeListView != null) |
||||
if(TreeListView.InvokeRequired) |
||||
throw(new Exception("Invoke required")); |
||||
// Do not add the item if the collection owns a TreeListView recursively
|
||||
// and the item already owns a TreeListView
|
||||
if(TreeListView != null && item.ListView != null) |
||||
throw(new Exception("The Item is already in a TreeListView")); |
||||
int index = GetInsertCollectionIndex(item); |
||||
if(index == -1) return(-1); |
||||
if(Parent != null) item.SetParent(Parent); |
||||
item.Items.Comparer = this.Comparer; |
||||
int treelistviewindex = GetInsertTreeListViewIndex(item, index); |
||||
// Insert in the ListView
|
||||
if(treelistviewindex > -1) |
||||
{ |
||||
ListView listview = (ListView) TreeListView; |
||||
listview.Items.Insert(treelistviewindex, (ListViewItem) item); |
||||
if(item.IsExpanded) item.Expand(); |
||||
item.SetIndentation(); |
||||
} |
||||
// Insert in this collection
|
||||
if(index > -1) List.Insert(index, item); |
||||
if(index > -1) OnItemAdded(new TreeListViewEventArgs(item, TreeListViewAction.Unknown)); |
||||
if(Count == 1 && TreeListView != null && Parent != null) |
||||
if(Parent.Visible) Parent.Redraw(); |
||||
return(index); |
||||
} |
||||
/// <summary>
|
||||
/// Adds an item in the collection and in the TreeListView
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="imageindex"></param>
|
||||
/// <returns></returns>
|
||||
public virtual TreeListViewItem Add(string value, int imageindex) |
||||
{ |
||||
TreeListViewItem item = new TreeListViewItem(value, imageindex); |
||||
Add(item); |
||||
return(item); |
||||
} |
||||
/// <summary>
|
||||
/// Adds an item in the collection and in the TreeListView
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public virtual TreeListViewItem Add(string value) |
||||
{ |
||||
TreeListViewItem item = new TreeListViewItem(value); |
||||
Add(item); |
||||
return(item); |
||||
} |
||||
/// <summary>
|
||||
/// Adds a collection to this collection
|
||||
/// </summary>
|
||||
/// <param name="collection"></param>
|
||||
public void AddRange(TreeListViewItemCollection collection) |
||||
{ |
||||
if(TreeListView != null) TreeListView.BeginUpdate(); |
||||
AddRangeInternal(collection); |
||||
if(TreeListView != null) TreeListView.BeginUpdate(); |
||||
} |
||||
internal void AddRangeInternal(TreeListViewItemCollection collection) |
||||
{ |
||||
foreach(TreeListViewItem item in collection) |
||||
Add(item); |
||||
} |
||||
#endregion
|
||||
#region Remove & Clear Functions
|
||||
/// <summary>
|
||||
/// Removes each node of the collection
|
||||
/// </summary>
|
||||
public new void Clear() |
||||
{ |
||||
TreeListView treelistview = this.TreeListView; |
||||
if(treelistview != null) treelistview.BeginUpdate(); |
||||
ClearInternal(); |
||||
if(treelistview != null) treelistview.EndUpdate(); |
||||
} |
||||
internal void ClearInternal() |
||||
{ |
||||
if(TreeListView != null) |
||||
if(TreeListView.InvokeRequired) |
||||
throw(new Exception("Invoke required")); |
||||
while(this.Count > 0) this.RemoveAtInternal(0); |
||||
} |
||||
/// <summary>
|
||||
/// Remove an item from the collection and the TreeListView
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
public virtual void Remove(TreeListViewItem item) |
||||
{ |
||||
TreeListView treelistview = this.TreeListView; |
||||
if(treelistview != null) treelistview.BeginUpdate(); |
||||
RemoveInternal(item); |
||||
if(treelistview != null) treelistview.EndUpdate(); |
||||
} |
||||
internal void RemoveInternal(TreeListViewItem item) |
||||
{ |
||||
if(TreeListView != null) |
||||
if(TreeListView.InvokeRequired) |
||||
throw(new Exception("Invoke required")); |
||||
int index = GetIndexOf(item); |
||||
if(index == -1) return; |
||||
RemoveAtInternal(index); |
||||
} |
||||
/// <summary>
|
||||
/// Gets the index of an item in the collection
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <returns></returns>
|
||||
public int GetIndexOf(TreeListViewItem item) |
||||
{ |
||||
if(TreeListView != null) |
||||
if(TreeListView.InvokeRequired) |
||||
throw(new Exception("Invoke required")); |
||||
int index = -1; |
||||
for(int i = 0 ; i < this.Count ; i++) |
||||
if(this[i] == item) {index = i; break;} |
||||
return(index); |
||||
} |
||||
/// <summary>
|
||||
/// Remove an item from the collection and the TreeListView
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
public new void RemoveAt(int index) |
||||
{ |
||||
TreeListView treelistview = this.TreeListView; |
||||
if(treelistview != null) treelistview.BeginUpdate(); |
||||
RemoveAtInternal(index); |
||||
if(treelistview != null) treelistview.EndUpdate(); |
||||
} |
||||
internal void RemoveAtInternal(int index) |
||||
{ |
||||
if(TreeListView != null) |
||||
if(TreeListView.InvokeRequired) |
||||
throw(new Exception("Invoke required")); |
||||
TreeListViewItem item = this[index]; |
||||
if(this[index].Visible && this.TreeListView != null) item.Hide(); |
||||
List.RemoveAt(index); |
||||
item.SetParent(null); |
||||
// Redraw parent if no more children
|
||||
if(Count == 0 && TreeListView != null && Parent != null) |
||||
Parent.Redraw(); |
||||
// Redraw new last item
|
||||
if(Count > 0 && TreeListView != null && index == Count) |
||||
this[index-1].Redraw(); |
||||
OnItemRemoved(new TreeListViewEventArgs(item, TreeListViewAction.Unknown)); |
||||
} |
||||
#endregion
|
||||
#region Internal Functions
|
||||
private int GetInsertTreeListViewIndex(TreeListViewItem item, int collectionindex) |
||||
{ |
||||
if(TreeListView == null) return(-1); |
||||
if(TreeListView.InvokeRequired) |
||||
throw(new Exception("Invoke required")); |
||||
if(Owner != null) |
||||
{ |
||||
int a = 0; |
||||
a++; |
||||
} |
||||
int index = -1; |
||||
// First level item (no parent)
|
||||
if(Owner != null && collectionindex != -1) |
||||
{ |
||||
if(collectionindex == 0) index = 0; |
||||
else index = |
||||
this[collectionindex - 1].LastChildIndexInListView + 1; |
||||
} |
||||
else if(Parent != null && collectionindex != -1) |
||||
{ |
||||
if(!Parent.Visible || !Parent.IsExpanded) index = -1; |
||||
else |
||||
{ |
||||
if(collectionindex == 0) index = Parent.Index + 1; |
||||
else index = |
||||
Parent.Items[collectionindex - 1].LastChildIndexInListView + 1; |
||||
} |
||||
} |
||||
return(index); |
||||
} |
||||
private int GetInsertCollectionIndex(TreeListViewItem item) |
||||
{ |
||||
if(TreeListView != null) |
||||
if(TreeListView.InvokeRequired) |
||||
throw(new Exception("Invoke required")); |
||||
int index = -1; |
||||
if(!_sortable) index = Count; |
||||
else if(!Contains(item) && !ListViewContains(item)) |
||||
{ |
||||
switch(SortOrder) |
||||
{ |
||||
// No sortorder -> at the end of the collection
|
||||
case System.Windows.Forms.SortOrder.None: |
||||
index = this.Count; |
||||
break; |
||||
default: |
||||
for(int i = 0 ; i < this.Count ; i++) |
||||
{ |
||||
// Change the index for the compare if the order is descending
|
||||
int indexcompare = i; |
||||
int comp = Comparer.Compare(item, this[indexcompare]); |
||||
if(comp <= 0) |
||||
{ |
||||
index = indexcompare; |
||||
break; |
||||
} |
||||
} |
||||
index = index == -1 ? this.Count : index; |
||||
break; |
||||
} |
||||
} |
||||
return(index); |
||||
} |
||||
#endregion
|
||||
} |
||||
} |
@ -1,157 +0,0 @@
@@ -1,157 +0,0 @@
|
||||
using System; |
||||
using System.Drawing; |
||||
using System.Runtime.InteropServices; |
||||
using System.Runtime.InteropServices.APIs; |
||||
|
||||
namespace System.Windows.Forms |
||||
{ |
||||
internal class CustomEdit : NativeWindow, IWin32Window |
||||
{ |
||||
#region Properties
|
||||
private TreeListViewItemEditControlHandle _editorhandle; |
||||
private EditItemInformations _informations; |
||||
private Control _editor; |
||||
new public IntPtr Handle |
||||
{ |
||||
get{return base.Handle;} |
||||
} |
||||
private TreeListView _treelistview; |
||||
#endregion
|
||||
#region Constructor & Destructor
|
||||
private CustomEdit(){} |
||||
public CustomEdit(IntPtr handle, TreeListView treelistview, Control editor) |
||||
{ |
||||
_treelistview = treelistview; |
||||
_informations = _treelistview.EditedItem; |
||||
if(editor == null) _editor = new TextBox(); |
||||
else _editor = editor; |
||||
_editor.Hide(); |
||||
if(!_treelistview.Controls.Contains(_editor)) |
||||
_treelistview.Controls.Add(_editor); |
||||
_editorhandle = new TreeListViewItemEditControlHandle(_treelistview, _editor, this); |
||||
AssignHandle(handle); |
||||
} |
||||
#endregion
|
||||
|
||||
#region Functions
|
||||
public void ShowEditControl() |
||||
{ |
||||
if(_treelistview.FocusedItem == null) return; |
||||
ListViewItem item = (ListViewItem) _treelistview.EditedItem.Item; |
||||
Rectangle rec = _treelistview.EditedItem.ColumnIndex > 0 ? |
||||
_treelistview.GetSubItemRect(item.Index, _treelistview.EditedItem.ColumnIndex) : |
||||
_treelistview.GetItemRect(item.Index, ItemBoundsPortion.Label); |
||||
_editor.Size = rec.Size; |
||||
_editor.Location = rec.Location; |
||||
_editor.Top--; |
||||
_editor.Show(); |
||||
_editor.Text = item.SubItems[_treelistview.EditedItem.ColumnIndex].Text; |
||||
_editor.Focus(); |
||||
} |
||||
public void HideEditControl() |
||||
{ |
||||
_editor.Hide(); |
||||
ReleaseHandle(); |
||||
_editorhandle.ReleaseHandle(); |
||||
} |
||||
#endregion
|
||||
|
||||
#region WndProc
|
||||
public void SendMessage(ref Message m) |
||||
{ |
||||
WndProc(ref m); |
||||
} |
||||
protected override void WndProc(ref Message m) |
||||
{ |
||||
switch(m.Msg) |
||||
{ |
||||
case (int)APIsEnums.WindowMessages.SHOWWINDOW: |
||||
bool show = m.WParam != IntPtr.Zero; |
||||
if(show) ShowEditControl(); |
||||
else HideEditControl(); |
||||
return; |
||||
} |
||||
} |
||||
#endregion
|
||||
} |
||||
internal class TreeListViewItemEditControlHandle : NativeWindow, IWin32Window |
||||
{ |
||||
#region Properties
|
||||
private CustomEdit _customedit; |
||||
private Control _control; |
||||
private TreeListView _treelistview; |
||||
new public IntPtr Handle |
||||
{ |
||||
get{return base.Handle;} |
||||
} |
||||
#endregion
|
||||
#region Constructor / Destructor
|
||||
public TreeListViewItemEditControlHandle(TreeListView treelistview, Control control, CustomEdit customedit) |
||||
{ |
||||
_control = control; |
||||
_treelistview = treelistview; |
||||
_customedit = customedit; |
||||
if(!control.Created) control.CreateControl(); |
||||
AssignHandle(control.Handle); |
||||
} |
||||
#endregion
|
||||
|
||||
#region End edit
|
||||
private void EndEdit(bool Cancel) |
||||
{ |
||||
if(!_treelistview.InEdit) return; |
||||
_treelistview.ExitEdit(Cancel, _control.Text); |
||||
} |
||||
#endregion
|
||||
#region OnKillFocus
|
||||
private bool OnKillFocus(Message m) |
||||
{ |
||||
// If the control is a combobox don't end edit if the handle is a handle
|
||||
// of one of the sub controls of the combobox
|
||||
if(!(_control is ComboBox)) return true; |
||||
APIsStructs.PCOMBOBOXINFO info = new APIsStructs.PCOMBOBOXINFO(); |
||||
info.cbSize = (uint)Marshal.SizeOf(typeof(APIsStructs.PCOMBOBOXINFO)); |
||||
if(!APIsUser32.GetComboBoxInfo(_control.Handle, ref info)) return true; |
||||
if(m.WParam == info.hwndCombo || m.WParam == info.hwndItem || m.WParam == info.hwndList) |
||||
{ |
||||
ReleaseHandle(); |
||||
AssignHandle(m.WParam); |
||||
return false; |
||||
} |
||||
return true; |
||||
} |
||||
#endregion
|
||||
#region Wndproc
|
||||
protected override void WndProc(ref Message m) |
||||
{ |
||||
switch(m.Msg) |
||||
{ |
||||
case (int) APIsEnums.WindowMessages.KEYDOWN: |
||||
Keys key = (Keys)(int) m.WParam; |
||||
if(key != Keys.Return && key != Keys.Escape) break; |
||||
bool Cancel = key != Keys.Enter; |
||||
EndEdit(Cancel); |
||||
return; |
||||
case (int) APIsEnums.WindowMessages.KILLFOCUS: |
||||
if(OnKillFocus(m)) |
||||
{ |
||||
EndEdit(!(_control is ComboBox && _treelistview.EditedItem.Label != _control.Text)); |
||||
return; |
||||
} |
||||
break; |
||||
} |
||||
base.WndProc(ref m); |
||||
} |
||||
private int HighOrder(IntPtr Param) |
||||
{ |
||||
int intparam = Param.ToInt32(); |
||||
return (intparam >> 16) & 0x0000ffff; |
||||
} |
||||
private int LowOrder(IntPtr Param) |
||||
{ |
||||
int intparam = Param.ToInt32(); |
||||
return intparam & 0x0000ffff; |
||||
} |
||||
#endregion
|
||||
} |
||||
} |
@ -1,42 +0,0 @@
@@ -1,42 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?> |
||||
<root> |
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> |
||||
<xsd:element name="root" msdata:IsDataSet="true"> |
||||
<xsd:complexType> |
||||
<xsd:choice maxOccurs="unbounded"> |
||||
<xsd:element name="data"> |
||||
<xsd:complexType> |
||||
<xsd:sequence> |
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> |
||||
</xsd:sequence> |
||||
<xsd:attribute name="name" type="xsd:string" /> |
||||
<xsd:attribute name="type" type="xsd:string" /> |
||||
<xsd:attribute name="mimetype" type="xsd:string" /> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
<xsd:element name="resheader"> |
||||
<xsd:complexType> |
||||
<xsd:sequence> |
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
||||
</xsd:sequence> |
||||
<xsd:attribute name="name" type="xsd:string" use="required" /> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
</xsd:choice> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
</xsd:schema> |
||||
<resheader name="ResMimeType"> |
||||
<value>text/microsoft-resx</value> |
||||
</resheader> |
||||
<resheader name="Version"> |
||||
<value>1.0.0.0</value> |
||||
</resheader> |
||||
<resheader name="Reader"> |
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.3102.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
||||
</resheader> |
||||
<resheader name="Writer"> |
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.3102.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
||||
</resheader> |
||||
</root> |
@ -1,85 +0,0 @@
@@ -1,85 +0,0 @@
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
<PropertyGroup> |
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
||||
<ProductVersion>8.0.50215</ProductVersion> |
||||
<SchemaVersion>2.0</SchemaVersion> |
||||
<ProjectGuid>{B08385CD-F0CC-488C-B4F4-EEB34B6D2688}</ProjectGuid> |
||||
<OutputType>Library</OutputType> |
||||
<RootNamespace>TreeListView</RootNamespace> |
||||
<AssemblyName>TreeListView</AssemblyName> |
||||
<WarningLevel>4</WarningLevel> |
||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> |
||||
<NoStdLib>False</NoStdLib> |
||||
<RegisterForComInterop>False</RegisterForComInterop> |
||||
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies> |
||||
<BaseAddress>112721920</BaseAddress> |
||||
<PlatformTarget>AnyCPU</PlatformTarget> |
||||
<FileAlignment>4096</FileAlignment> |
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
||||
<DebugSymbols>true</DebugSymbols> |
||||
<DebugType>Full</DebugType> |
||||
<Optimize>false</Optimize> |
||||
<OutputPath>..\..\..\..\..\..\AddIns\AddIns\Misc\Debugger\</OutputPath> |
||||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
||||
<DebugType>pdbonly</DebugType> |
||||
<Optimize>true</Optimize> |
||||
<OutputPath>..\..\..\..\..\..\AddIns\AddIns\Misc\Debugger\</OutputPath> |
||||
<DefineConstants>TRACE</DefineConstants> |
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> |
||||
</PropertyGroup> |
||||
<ItemGroup> |
||||
<Reference Include="System" /> |
||||
<Reference Include="System.Data" /> |
||||
<Reference Include="System.Drawing" /> |
||||
<Reference Include="System.Windows.Forms" /> |
||||
<Reference Include="System.Xml" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Compile Include="Configuration\AssemblyInfo.cs" /> |
||||
<Compile Include="Src\APIs\APIsClipboard.cs" /> |
||||
<Compile Include="Src\APIs\APIsComctl32.cs" /> |
||||
<Compile Include="Src\APIs\APIsEnums.cs" /> |
||||
<Compile Include="Src\APIs\APIsGdi.cs" /> |
||||
<Compile Include="Src\APIs\APIsMenu.cs" /> |
||||
<Compile Include="Src\APIs\APIsShell.cs" /> |
||||
<Compile Include="Src\APIs\APIsShlwapi.cs" /> |
||||
<Compile Include="Src\APIs\APIsStructs.cs" /> |
||||
<Compile Include="Src\APIs\APIsUser32.cs" /> |
||||
<Compile Include="Src\APIs\APIsUxTheme.cs" /> |
||||
<Compile Include="Src\APIs\APIsWndProc.cs" /> |
||||
<Compile Include="Src\APIs\ColorUtil.cs" /> |
||||
<Compile Include="Src\APIs\COMInterfaces.cs" /> |
||||
<Compile Include="Src\APIs\TextUtil.cs" /> |
||||
<Compile Include="Src\TreeListView\Forms\TreeListViewItemsEditor.cs"> |
||||
<SubType>Form</SubType> |
||||
</Compile> |
||||
<Compile Include="Src\TreeListView\ITreeListViewItemComparer.cs" /> |
||||
<Compile Include="Src\TreeListView\SelectedTreeListViewItemCollection.cs" /> |
||||
<Compile Include="Src\TreeListView\TreeListView.cs"> |
||||
<SubType>Component</SubType> |
||||
</Compile> |
||||
<Compile Include="Src\TreeListView\TreeListViewItem.cs" /> |
||||
<Compile Include="Src\TreeListView\TreeListViewItemCollection.cs" /> |
||||
<Compile Include="Src\TreeListView\TreeListViewSubItemEdit.cs" /> |
||||
<EmbeddedResource Include="Resources\System.Windows.Forms.TreeListView.resources" /> |
||||
<EmbeddedResource Include="Src\TreeListView\Forms\TreeListViewItemsEditor.resx"> |
||||
<DependentUpon>TreeListViewItemsEditor.cs</DependentUpon> |
||||
</EmbeddedResource> |
||||
<EmbeddedResource Include="Src\TreeListView\TreeListView.resx"> |
||||
<DependentUpon>TreeListView.cs</DependentUpon> |
||||
</EmbeddedResource> |
||||
<EmbeddedResource Include="Src\TreeListView\TreeListViewSubItemEdit.resx"> |
||||
<DependentUpon>TreeListViewSubItemEdit.cs</DependentUpon> |
||||
</EmbeddedResource> |
||||
<None Include="Doc\Readme.txt" /> |
||||
<EmbeddedResource Include="Src\TreeListView\Icons\Minus.gif" /> |
||||
<EmbeddedResource Include="Src\TreeListView\Icons\Plus.gif" /> |
||||
</ItemGroup> |
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> |
||||
</Project> |
@ -1,7 +0,0 @@
@@ -1,7 +0,0 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
<PropertyGroup> |
||||
<LastOpenVersion>8.0.50215</LastOpenVersion> |
||||
<ProjectView>ProjectFiles</ProjectView> |
||||
<ProjectTrust>0</ProjectTrust> |
||||
</PropertyGroup> |
||||
</Project> |
Loading…
Reference in new issue