Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Drawing;
- using System.Drawing.Drawing2D;
- using System.Runtime.InteropServices;
- namespace DrawTest {
- class Program {
- [DllImport("user32.dll", EntryPoint = "GetDesktopWindow")]
- static extern IntPtr GetDesktopWindow ();
- [DllImport("User32.dll")]
- static extern IntPtr GetDC ( IntPtr hwnd );
- [DllImport("User32.dll")]
- static extern void ReleaseDC ( IntPtr dc );
- static void Main ( string[] args ) {
- while( true ) {
- IntPtr desktop = GetDC(GetDesktopWindow());
- using( Graphics g = Graphics.FromHdc(desktop) ) {
- g.FillRectangle(Brushes.White, 0, 0, 100, 100);
- System.Threading.Thread.Sleep(10);
- }
- ReleaseDC(desktop);
- }
- System.Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement