摘要:
将以前自己做过的一些比较独特的功能拿出来,与大家分享。
做的不好,请大家多多优化功能。提出自己的方法。
public static void ListView_ColumnClick(object sender, ColumnClickEventArgs e)
{
ListView lv = sender as ListView;
// 检查点击的列是不是现在的排序列.
if (e.Column == (lv.ListViewItemSorter as ListViewColumnSorter).SortColumn)
{
// 重新设置此列的排序方法.
if ((lv.ListViewItemSorter as ListViewColumnSorter).Order == SortOrder.Ascending)
{
阅读全文
摘要:
public class ShellImages
{
#region DLLIMPORT
// Retrieves information about an object in the file system,
// such as a file, a folder, a directory, or a drive root.
[DllImport("shell32",
EntryPoint = "SHGetFileInfo",
ExactSpelling = false,
CharSet = CharSet.Auto,
SetLastError = true)]
private static extern IntPtr SHGetFileInfo(
string pszPath, //指定的文件名
FILE_ATTRIBUTE dwFileAttributes, //文件属性
ref SHFILEINFO sfi, //返回获得的文件信息,是一个记录类型
阅读全文
摘要:
using System.Drawing;
using System.Drawing.Text;
.....
//load the installed fonts and iterate through the collections
InstalledFontCollection fonts = new InstalledFontCollection();
foreach(FontFamily family in fonts.Families) //FontFamily.Families
{
//ensure font supports regular,bolding,underlining,and italics
if(family.IsStyleAvailable(FontStyle.Regular & FontStyle.Bold &
FontStyle.Italic & FontStyle.Underline)) 阅读全文