Пример #1
0
        /// <summary>
        /// take screenshot and save to a file
        /// </summary>
        /// <param name="filepath"></param>
        /// <returns></returns>
        public static string TakeScreenshot(string filepath)
        {
            if (string.IsNullOrEmpty(filepath))
            {
                filepath = string.Format(@"{0}\{1}.png", Environment.CurrentDirectory, TextHelper.RandomString(10));
            }

            var bmp = TakeSnapshot();

            bmp.Save(filepath, ImageFormat.Png);

            return(filepath);
        }