Answer the question
In order to leave comments, you need to log in
Rectangle on a transparent form or directly on the screen
I am writing an application in c# to capture a screenshot from the desktop. It was necessary to add the ability to take a screenshot of the desktop area. To do this, you need to create a rectangular selection of the following plan:
A rectangle filled with color, preferably with the ability to resize and move.
Problem: if I create a form with hidden borders and controls as a rectangle, then I can move and resize, though through my ass, but I don’t know how to block access to the desktop outside the rectangle. If I first create a form and expand it to full screen and draw a rectangle on it, then everything slows down and flickers a lot when resizing and moving the rectangle, besides, I can’t make the form transparent so that the rectangle remains visible at the same time.
I really need help!
Once again, what you want:
1. Rectangular selection
2. Create a selection in the style of a normal selection windows - clicked the mouse in the desired area, dragged the mouse - a rectangle was created, released the mouse - the rectangle remained.
3. The desktop around the rectangle should be inaccessible until the program takes a screen.
4. Ideally, make the background around the rectangle shaded and the rectangle itself a transparent area in the shading.
Pliz pliz pliz, I suffer for 8 hours. I write ~20 hours in c# =(
Reading mana and googling in runet and bourgeois did not help much.
Answer the question
In order to leave comments, you need to log in
Take a screenshot, make a normal form in full screen size without controls (WindowStyleSomething=null), put a screenshot in the background of the form, and draw a rectangle on top.
No form needed. It is necessary to create a window, without a frame, with the property always on top, and with the property (I don’t remember what it’s called), which in WinAPI enables offscreen rendering for the window, allows you to make it translucent, etc. Resize and drag the window, manually catching events and processing.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question