I am looking to get the same effect as the GraphicsPath from Winforms which allows to keep some particular areas of myForm unrefreshed. f.i.:
myForm.Invalidate(new Region(graphicsPath));
My final goal is to draw things at the unrefreshed location, using a HDC (Device context handle) that I will provide to an external application. (This currently works using winforms).
I am using SFML.Net 2.4 and I create my window this way:
SFML.Graphics.RenderWindow mySfmlWindow = new RenderWindow(myForm.Handle, settings);
I can still create the HDC on myForm, however, even without calling :
mySfmlWindow.Clear(color);
, the things drawn by the external application are still instantly cleared.
Manual approach
You can draw your desired background yourself. I've got an example, where I draw a half of the window background manually, while the other half is not cleared.
The left half is "cleared" in gray just to show the point.
In the code, I use a
sf::RectangleShapeto clear the window, but you can use asf::VertexArrayif your shape is more complex.Full Code