Advertisement
Guest User

Untitled

a guest
Jul 7th, 2015
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. Bitmap bmp;
  2. Graphics g;
  3.  
  4. public MainForm()
  5. {
  6. InitializeComponent();
  7.  
  8. this.DoubleBuffered = true;
  9.  
  10. this.MouseMove += new MouseEventHandler(mouseMove);
  11. bmp = new Bitmap(this.Width, this.Height);
  12. g = Graphics.FromImage(bmp);
  13. }
  14.  
  15. protected override void OnPaint(PaintEventArgs e)
  16. {
  17. Point p = PointToClient(Cursor.Position);
  18. g.FillRectangle(Brushes.Black, new Rectangle(p.X,p.Y, 40, 40));
  19. e.Graphics.DrawImage(bmp, Point.Empty);
  20. g.Clear(Color.Transparent);
  21. }
  22.  
  23. private void mouseMove(object sender, MouseEventArgs e)
  24. {
  25. this.Invalidate();
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement