User moves and resizes controls with a mouse at runtime

M

Max

In my program I have a form and several controls on it.
I need to give to user a possibility to move and resize them at runtime.
The only way to do so I could find till now is to handle mouse events and
change size and position accordingly.
From other hand this functionality is already implemented in design time.
Is there any simpler way to implement it in run time?

Thank you in advance.
 
H

Herfried K. Wagner [MVP]

* "Max said:
In my program I have a form and several controls on it.
I need to give to user a possibility to move and resize them at runtime.
The only way to do so I could find till now is to handle mouse events and
change size and position accordingly.
From other hand this functionality is already implemented in design time.
Is there any simpler way to implement it in run time?

<http://www.icsharpcode.net/OpenSource/SD/>
 
M

Max

Unfortunately anchoring has nothing to do with move and resize.
I want the user to be able to move and resize CONTROL ON THE FORM and not
the control to be move and resized according the size of the form.
 
M

Max

That's a great link and a great project, but I do not think it is a "simple"
way.
Downloading this project, understanding how did they implement that, ...
will take time.
Besides, I do not need the fully functional IDE.
I just want the controls to be moved and resized.
(That's a kind of diagram editor. Each diagram object is a .NET control.)

Thank you for interesting link any way.
 
J

Joshua Flanagan

You could add a PropertyGrid control (you need to add it to your toolbox, it
isnt there by default) to your form. Then use some runtime code to allow
the user to choose which control to select in the PropertyGrid. Once the
control is selected in the PropertyGrid, the user will have access to all of
its properties, including size and location.
 
M

Max

Looks like it is exactly what I need.
Moreover I thought of writing exactly such a control before I knew that you
already have written one.
But, most likely I won't buy it.

Thank you for answering.
 
M

Mountain Bikn' Guy

Maybe I don't understand the question, but it sounds simple to me. I do
this, and I've seen many applications donig it by using splitters, panels,
etc. Maybe, by "moving", Max means more than what can be accomplished via
splitters. For that solution, I use docking windows to get the functionality
seen in VS.NET. This has the benefit of even allowing the control to be
moved OFF the form at runtime.
HTH
 
M

Max

I meant the functionality similar to what you have in Visual Studio form
designer.
Fore now I have two possibilities - one implement Drag, and Mouse... event
handlers or to embed a designer in my program as shown in the link posted by
Joe White
(http://www.divil.co.uk/net/articles/designers/hosting.asp).

Looks like I am going to implement event handlers. It is due to the nature
of the controls. Some of them are not rectangular and a rectangular
"resizer" of the standard designer does not look good on them.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top