A
A
Artem2021-03-20 21:43:07
C++ / C#
Artem, 2021-03-20 21:43:07

How to make/draw controls in Windows Forms to resize an object?

I'm slowly getting to know Windows Forms and ran into a problem.
For a better understanding, let's assume that there is an image in the program window that the user can resize. And I want to implement this with the help of controls (sliders, draggers, xs how to do it right), as in the editor itself (example in the picture).
60563fc662fa6972986871.png
Those. the logic is as follows: the user clicks on the picture, these controls appear, the user changes the size of the picture with their help, pokes in an empty space and the controls disappear.
How can I do that? You need to somehow draw dotted lines, buttons at the corners and sides, I don’t understand at all.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Artem, 2021-03-21
@Timon1221

I found such a thing
Simple Runtime Control Sizing and Dragging Class
Connect the file to the project, send the element to which you want to add controls to the WireControl.
And that's it, now when you click on this element, you can drag and resize it.

H
HemulGM, 2021-03-20
@HemulGM

You create small panels on top of all elements. Each panel is responsible for its own action. The dotted line is the frame of your picture. More precisely, the container that contains the image.

R
RealLazyCat, 2021-03-21
@RealLazyCat

create one panel, throw the "edit" buttons on it (change the size, color). To work with images there is a PictureBox component, add it to the form. when you click on it (focus), you can show a panel with "tools", when you lose "focus", i.e. when clicking on other elements, you can hide the panel with "tools"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question