2

Assuming that you know about drop box(no problem if you don't know).

In my desktop application there is an upload functionality. I want to mark correct sign on file icon at bottom left after upload.(same as Dropbox does).

How can I do that? What's that trick?

Priyank
  • 1,219
  • 11
  • 30
  • possible duplicate of [Shell Icon Overlay (C#)](http://stackoverflow.com/questions/843506/shell-icon-overlay-c) – James Hill Oct 19 '11 at 12:33

1 Answers1

1

DropBox is a shell extension, so it uses the OS icons and overlay them.

In your case, if it's a desktop application you can overlay your icons using something similar to this:

    private static object mOverlayLock = new object();
    public static Image GetOverlayedImage(Image baseImage, Image overlay)
    {
        Image im = null;

        lock (mOverlayLock)
        {
            try
            {
                im = baseImage.Clone() as Image;

                Graphics g = Graphics.FromImage(im);
                g.DrawImage(overlay, 0, 0, im.Width, im.Height);
                g.Dispose();
            }
            catch
            {
                // LOG EXCEPTION!!
            }
        }

        return im;
    }

This is a basic example. You can also play with the overlay position, (topleft, middleleft ...), that requires a little bit more programming.

Then, from your application you can call this method to get the result image. For example

...
Image folderIcon = GetFolderIcon();
Image upToDateOverlay = GetUpToDateOverlay();
Image folderUptoDate = GetOlverlayedImage(folderIcon, upToDateOverlay);
// Then assign this image to your control item (treelistnode, listViewnode, whatever)
Daniel Peñalba
  • 30,507
  • 32
  • 137
  • 219