protected override void WndProc(ref Message message) { try { switch (message.WParam.ToInt64()) { case 936: { if (this.Visible == false) { this.Location = new Point(System.Windows.Forms.Screen.FromPoint(Cursor.Position).Bounds.X, System.Windows.Forms.Screen.FromPoint(Cursor.Position).Bounds.Y); this.Width = System.Windows.Forms.Screen.FromPoint(Cursor.Position).Bounds.Width; this.Height = System.Windows.Forms.Screen.FromPoint(Cursor.Position).Bounds.Height; bitmapScreen = new Bitmap(this.Width, this.Height); using (Graphics graphics = Graphics.FromImage(bitmapScreen as Image)) { graphics.CopyFromScreen(System.Windows.Forms.Screen.FromPoint(Cursor.Position).Bounds.X, System.Windows.Forms.Screen.FromPoint(Cursor.Position).Bounds.Y, 0, 0, this.Size); } picture.Image = bitmapScreen; graphicsScreen = picture.CreateGraphics(); AnimateWindow(this.Handle, 8, 0x00000010 + 0x00080000 + 0x00020000); SetForegroundWindow(this.Handle); this.Visible = true; magnifier.Visible = true; Cursor.Hide(); } else { this.Visible = false; magnifier.Visible = false; Cursor.Show(); GC.Collect(); } break; } case 937: { List <Bitmap> bitmaps = new List <Bitmap>(); System.Collections.Specialized.StringCollection files = Clipboard.GetFileDropList(); if (files != null) { foreach (string file in files) { try { bitmaps.Add(new Bitmap(file)); } catch { } } } Image image = Clipboard.GetImage(); if (image != null) { bitmaps.Add(new Bitmap(image)); image.Dispose(); } foreach (Bitmap bitmap in bitmaps) { if (bitmap.Width > 15 && bitmap.Height > 15) { RotateImage(bitmap); Rectangle rectangle = new Rectangle(SystemInformation.VirtualScreen.X + 1, SystemInformation.VirtualScreen.Y + 1, SystemInformation.VirtualScreen.Width - 2, SystemInformation.VirtualScreen.Height - 2); int width = bitmap.Width, height = bitmap.Height; if (width > rectangle.Width) { width = rectangle.Width; height = width * bitmap.Height / bitmap.Width; } if (height > rectangle.Height) { height = rectangle.Height; width = height * bitmap.Width / bitmap.Height; } int x = Cursor.Position.X - width / 2, y = Cursor.Position.Y - height / 2; x = x < rectangle.Left ? rectangle.Left : x; y = y < rectangle.Top ? rectangle.Top : y; x = x + width > rectangle.Right ? (rectangle.Right - width) : x; y = y + height > rectangle.Bottom ? (rectangle.Bottom - height) : y; Note note = new Note(bitmap, new Point(x, y), new Size(width, height)); note.Show(); } else { bitmap.Dispose(); } } GC.Collect(); break; } } base.WndProc(ref message); } catch { base.WndProc(ref message); return; } }