/// <summary> /// Load pictures from MyPictures /// </summary> /// <returns></returns> private bool LoadPictures() { int nPicturesLoaded = 0; float dpiX, dpiY; using (Graphics g = Graphics.FromHwnd(Handle)) { dpiX = g.DpiX; dpiY = g.DpiY; } try { foreach (string filePath in Directory.GetFiles( Environment.GetFolderPath(Environment.SpecialFolder.MyPictures), "*.jpg")) { try { Picture p = new Picture(filePath, dpiX, dpiY); _canvas.Add(p); p.Translate = new SizeF((Width - p.Width) / 2, (Height - p.Height) / 2); ++nPicturesLoaded; if (nPicturesLoaded == NumOfPictures) return true; } catch { } } return _canvas.Count > 0; } catch { } return false; }
public void MovePictureToFront(Picture picture) { _pictures.Remove(picture); _pictures.Add(picture); }
private void BringPictureToFront(Picture picture) { _canvas.MovePictureToFront(picture); }
public void Add(Picture picture) { _pictures.Add(picture); }