Пример #1
0
        public virtual int CompareTo(Column column, IFolderObject obj)
        {
            // get the values for this item and the other item in the
            // specified column

            object value1 = GetColumnValue(column);
            object value2 = obj.GetColumnValue(column);

            if (column != null && column.Comparer != null)
            {
                // the column provides a comparer
                return(column.Comparer.Compare(value1, value2));
            }
            else if (value1 == null && value2 != null)
            {
                return(1);                      // sort empty column values to the bottom
            }
            else if (value2 == null && value1 != null)
            {
                return(-1);                     // sort empty column values to the bottom
            }
            else if (value1 == null && value2 == null ||
                     !(value1 is IComparable && value2 is IComparable))
            {
                // compare the display names as a last resort
                return(GetDisplayName(NameOptions.Normal).CompareTo(obj.GetDisplayName(NameOptions.Normal)));
            }
            else
            {
                // the values implement IComparable, so work with that;
                // hopefully the values are compatible
                return(((IComparable)value1).CompareTo(value2));
            }
        }
Пример #2
0
        public int Extract(out IntPtr phBmpThumbnail)
        {
            // ShellIcon icon = folderObj.GetIcon(false);

            Bitmap bmp;
            Bitmap bmpNew = new Bitmap(m_size.Width, m_size.Height, PixelFormat.Format32bppArgb);

/*
 *          if (icon is ShellIcon.FromFile)
 *          {
 *              ShellIcon.FromFile fif = icon as ShellIcon.FromFile;
 *              IntPtr hIcon = (IntPtr) Shell32.ExtractIcon(IntPtr.Zero, fif.Filename, fif.Index);
 *                          Icon iconret = Icon.FromHandle(hIcon);
 *              bmp = iconret.ToBitmap();
 *          }
 *          else //(icon is ShellIcon.FromIcon)
 *          {
 *              ShellIcon.FromIcon fi = icon as ShellIcon.FromIcon;
 *              bmp = fi.Icon.ToBitmap();
 *          }
 */
            using (Graphics g = Graphics.FromImage(bmpNew))
            {
                //using (Pen p = new Pen(Color.Black))
                {
                    // g.DrawImage(bmp, 0, 0);
                    g.Clear(Color.Red);
                    g.DrawString(folderObj.GetDisplayName(NameOptions.Normal), SystemFonts.DefaultFont, new SolidBrush(Color.Black), 0, 0);


                    //g.DrawLine(p, 0, 0, m_size.Width, m_size.Height);
                }
            }

            phBmpThumbnail = bmpNew.GetHbitmap();

            return(WinError.S_OK);
        }