Exemple #1
0
        /// <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;
        }
Exemple #2
0
 public void MovePictureToFront(Picture picture)
 {
     _pictures.Remove(picture);
     _pictures.Add(picture);
 }
Exemple #3
0
 private void BringPictureToFront(Picture picture)
 {
     _canvas.MovePictureToFront(picture);
 }
Exemple #4
0
 public void Add(Picture picture)
 {
     _pictures.Add(picture);
 }