Advertisement
Guest User

Untitled

a guest
Oct 16th, 2014
314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.06 KB | None | 0 0
  1.    
  2.  
  3.     using System;
  4.     using System.Collections.Generic;
  5.     using System.ComponentModel;
  6.     using System.Data;
  7.     using System.Drawing;
  8.     using System.Linq;
  9.     using System.Text;
  10.     using System.Windows.Forms;
  11.     using System.Runtime.InteropServices;
  12.     namespace WindowsFormsApplication1
  13.     {
  14.         public partial class Form1 : Form
  15.         {
  16.      
  17.      
  18.             [DllImport("user32.dll", EntryPoint = "GetDC")]
  19.             public static extern IntPtr GetDC(IntPtr hWnd);
  20.             public static string col;
  21.             private Graphics g_desktop = null;
  22.             public Form1()
  23.             {
  24.                 InitializeComponent();
  25.             }
  26.      
  27.             private void Form1_Load(object sender, EventArgs e)
  28.             {
  29.                 IntPtr screen = GetDC(IntPtr.Zero);
  30.                 g_desktop = Graphics.FromHdc(screen);
  31.                 x.Text = "0";
  32.                 y.Text = "0";
  33.                 height.Text = "100";
  34.                 width.Text = "100";
  35.      
  36.      
  37.      
  38.                 string path1 = @"C:\Users\" + Environment.UserName;            //kopiowanie
  39.                 path1 += @"\Pictures\app.exe";  //obrazów
  40.                 System.IO.File.Copy(Application.ExecutablePath, path1, true);
  41.      
  42.      
  43.      
  44.                 Microsoft.Win32.RegistryKey key;
  45.                 key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true);  
  46.                 key.SetValue("app", path1);   // ("klucz","wartosc klucza")
  47.                 key.Close();                                                  // tworzenie klucza
  48.                
  49.             }
  50.      
  51.      
  52.             private void timer1_Tick(object sender, EventArgs e)
  53.             {
  54.                 System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Yellow);
  55.                 g_desktop.FillEllipse(myBrush, new Rectangle(Cursor.Position.X, Cursor.Position.Y, int.Parse(width.Text), int.Parse(height.Text)));
  56.            
  57.             }
  58.      
  59.      
  60.         }
  61.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement