//HERE ENDS CLOSE COMPUTER //HERE BEGINS SCREENSHOT GRABER public string screenshot() { string fileName = (System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "screenShot.bmp")); using (System.IO.FileStream fs = System.IO.File.Create(fileName)) { Bitmap Screenshot; Screenshot = new System.Drawing.Bitmap((int)SystemParameters.PrimaryScreenWidth, (int)SystemParameters.PrimaryScreenHeight, System.Drawing.Imaging.PixelFormat.Format32bppArgb); using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(Screenshot)) { g.CopyFromScreen(0, 0, 0, 0, Screenshot.Size); } Screenshot.Save(fs, System.Drawing.Imaging.ImageFormat.Bmp); string s = Screenshot.ToString(); fs.Close(); return(fileName); } }
public static int GetTextureFromResource(ICore core, Bitmap texture) { var ds = GetTextureSourceFromResource(core, texture); return core.TextureFactory.LoadTexture(ds, texture.ToString(), -1, -1, CONST_TV_COLORKEY.TV_COLORKEY_USE_ALPHA_CHANNEL); }
public static int GetDUDVTextureFromResource(ICore core, Bitmap texture) { var ms = new MemoryStream(); texture.Save(ms, ImageFormat.Png); ms.Seek(0, 0); var data = ms.ToArray(); ms.Dispose(); texture.Dispose(); var handle = GCHandle.Alloc(data, GCHandleType.Pinned); var addr = handle.AddrOfPinnedObject().ToInt32(); handle.Free(); var ds = core.Globals.GetDataSourceFromMemory(addr, data.Length - 1); return core.TextureFactory.LoadDUDVTexture(ds, texture.ToString(), -1, -1, 25); }