Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Unfortunately I'm providing the answer in C# at this time. Luckily, just syntax and not content will have to change.</p> <p>Assuming this is your picturebox control, take the contents (as a bitmap) and put it on the clipboard. Now you can paste it into MSPaint however you'd like with SendMessage or SendKeys if you make it foreground, etc.</p> <pre><code>Bitmap bmp = new Bitmap(pictureBox1.Image); Clipboard.SetData(System.Windows.Forms.DataFormats.Bitmap, bmp); </code></pre> <p>A poor example, with the optional opening of the mspaint and waiting for it to appear, using SendKeys to paste.</p> <pre><code> [DllImport("User32.dll", SetLastError = true)] public static extern IntPtr FindWindowEx(IntPtr parentHandle, IntPtr childAfter, string className, string windowTitle); [DllImport("user32.dll")] private static extern IntPtr GetForegroundWindow(); [DllImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] static extern bool SetForegroundWindow(IntPtr hWnd); private static void TestSendPictureToMSPaint() { Bitmap bmp = new Bitmap(pictureBox1.Image); Clipboard.SetData(System.Windows.Forms.DataFormats.Bitmap, bmp); //optional#1 - open MSPaint yourself //var proc = Process.Start("mspaint"); IntPtr msPaint = IntPtr.Zero; //while (msPaint == IntPtr.Zero) //optional#1 - if opening MSPaint yourself, wait for it to appear msPaint = FindWindowEx(IntPtr.Zero, new IntPtr(0), "MSPaintApp", null); SetForegroundWindow(msPaint); //optional#2 - if not opening MSPaint yourself IntPtr currForeground = IntPtr.Zero; while (currForeground != msPaint) { Thread.Sleep(250); //sleep before get to exit loop and send immediately currForeground = GetForegroundWindow(); } SendKeys.SendWait("^v"); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload