Contextmenu and Picturebox c++ - c++

I created a program like Paint and ran into this problem: I have a PictureBox where I can draw, but I want to be able to copy and paste part of the image from my PictureBox. Created Contextmenu, but I can not properly describe the copy and paste commands. I work in C ++ and want to know if it is possible to do such an action?
If possible, give an example of a simple copy and paste image code.

Related

How can I unparent, move or resize Steam Overlay of a third party app?

I'm trying to create a extension for a game engine to fix a issue that it got with Steam Overlay...
The SteamWorks extension isn't open source and it seems to be parenting the GameOverlayUI.exe to a child window of the application, problem is that this child window can be moved and resized, meaning the Steam Overlay would do the same with it, resulting in the overlay being cropped and bigger than it should.
I need to be able to resize and move SteamOverlay or parent it to another window to fix this and have more control of how it looks in certain games.
Any ideas?

Inkscape creates pixelated images whenever I copy and paste

Whenever I copy and paste something in Inkscape the result is a pixelated image and not the original object. For example a copied and pasted rectangle cannot be edited as a rectangle anymore and gets blurry if I zoom in.
I am working on OSX 10.10.1 and X11 2.7.7.
This has to do with the clipboard and pasteboard syncing of OSX and X11. As pointed out in the Inkscape FAQ you can prevent this by unchecking X11 preferences > Pasteboard: "Update Pasteboard when CLIPBOARD changes". Downside is that you cannot copy anything from Inkscape to other OSX programs anymore. From OSX to X11 should still be possible.
If you use duplicate instead of copy and paste the problem doesn't appear in the first place, so you can keep the pasteboard syncing.
Duplicate and then what? Duplicate and Paste just creates a raster copy of the vector object. However, after many trials and errors, I found that Duplicate and then Paste In Place results in a vector-to-vector copy.
Use Ctrl+D
Pressing Ctrl+C and Ctrl+V to copy and paste will create a bitmap image for the copy. To create a vector copy, you can make a selection and then press Ctrl+D. The D is for Duplicate.

cimg multiple window placement

I'm using CImgDisplay to show a couple of images onscreen. My problem is that they're opening on top of the Command Prompt window and each other. Is there a way to make them open at a different location? I've looked through the CImg documentation and can't find anything.
CImgDisplay::move() will probably help you, as it can move a window to a specific position.
If necessary, you can create an initially hidden windows, move it, then show it afterwards, using CImgDisplay::show().

Save Gtk.DrawingArea to Bitmap

I need to save image of my DrawingArea object to Bitmap, but I can't find how to do it. Can anybody tell, how save DrawingArea image to Bitmap?
There are a few ways to do this, it depends exactly what you want to do and whether/why you really need a System.Drawing.Bitmap.
Copy the Widget
You can P/Invoke gtk_widget_get_snapshot to get a Gdk.Pixbuf.
The Pixbuf can be can be saved into a a file, or copied into a System.Drawing.Bitmap.
Using System.Drawing
You could port your drawing code to the System.Drawing API.
In your DrawingArea's Expose method, use Gtk.DotNet.Graphics.FromDrawable to get a System.Drawing.Graphics for your widget and draw onto that using your ported drawing code.
Then, you can create a System.Drawing.Bitmap and use the same drawing code to draw to it.
Using Cairo
You could port your drawing code to Mono.Cairo (the new GTK# drawing APIs, which are much more powerful than System.Drawing).
In your DrawingArea's Expose method, use Gdk.CairoHelper.Create to get a Cairo context for your widget and draw onto that using your ported drawing code.
Then, you can use your Cairo drawing logic to write to a Cairo ImageSurface, which can be saved into a a file, or copied into a System.Drawing.Bitmap.

How to show Iplmage format on the GUI of C++ instead of showing it in another windows?

I'm trying to display the output image onto the C++ interface instead of creating another window to display the image.
For example: cvNameWindow("Window A",0);
cvShowImage("Window A", imgA);
This will create an window and display the imgA on it.
My question is that can i display my imgA onto my C++ interface together with all my other button and textbox.
I'm using Borland C++ Builder 6 and OpenCV.
For one thing, since it's open source, you can have a look at the cvShowImage implementation for Windows here.
My C++ Builder memories are a bit fuzzy but I guess you can skip all the CvWindow calls and use any control's (a PaintBox?) GetDeviceContext() to its the DC and GetClientRect() to get its size.
Hope this helps.
You will need to convert the IplImage to a Graphics::TBitmap with this. Then you can draw it as here.