Click here to Skip to main content
14,697,262 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
What is the used here technology ?

I want to do it..
What is the used algorithm ? or api thank you
Technology of what? Don't you think it would be better to ask the author of that video?
Member 11256349 23-Nov-14 4:55am
Technology of what?
dynamic associated object creation and I'm looking for examples of projects related to it

I asked the author but did not answer
BillWoodruff 23-Nov-14 4:18am
I do not have time to go watch a video to figure out how to assist you, but if you take the time to describe what you saw in the video, and describe what you want in detail, sure, I'll try and assist you.
Member 11256349 23-Nov-14 4:54am
thank you
Sergey Alexandrovich Kryukov 23-Nov-14 13:31pm
Very good idea, Bill. I also wouldn't watch the video.
But, thanks to that idea, OP described the problem in 6 lines of text; and I even tried to answer it with some advice which always worked out so far. :-)
Member 11256349 23-Nov-14 5:08am
My application is some sort of a form designer. I want dynamic creating objects(textboxes, labels, buttons) from a toolbox. I want these objects to be dragged around as the user wishes but within a single division. I dont want these objects to be dragged outside that division. Can anyone plz help me with this drag and drop about
example video
I want to make like visual studio ( drag drop object runtime create )
BillWoodruff 23-Nov-14 15:14pm
Somehow a long comment I created here a few hours ago did not get posted.

In that comment I asked you to define more specifically the functionality you need on the "Design Surface:" it's one thing if there's only one "container" that you drop things on; it's adds another level of complexity if you want to allow the user to drag/drop other "Containers" (think of a Panel) on the Design Surface, and then, when the user drag/drops other Controls into the bounds of the Container have those new objects placed "inside" the Container.

Also, need to know if this WinForms, or WPF, or ???

More details, please.

1 solution

There is no a problem of "dynamic creation of objects". In that sense of the word "dynamic" you meant, they are always created dynamically, not any other way.

This is the advice I always give: just look at what existing Visual Studio designer does. With Forms, designer automatically generates some code which serves a role of the source code at the same time. When you open a form or a user control with the designer, existing code is read, and then you can modify it using the designer. All you need to do it to open that source code file found under the Solution Explorer node of that form or user control. If you don't know how to write some code but know how to do it with the designer, make a sample with the designer and then look at the auto-generated code.

In particular, it will show you the generation and adding control. Let's assume you already have some parent control, such as a form or a panel. Now you add new controls to it, for example:
Panel parent = //... let's assume you already have it
ComboBox comboBox = new ComboBox();
Label label = new Label();
label.Text = "Some &Text";
// ... set Left, Top, Dock, Padding
// ... in some controls, Width or Height or both...
// ... other properties...
// now, adding:
parent.Controls.Add(label); // a child has been added
comboBox.Parent = parent; // an equivalent way

And so on…

BillWoodruff 24-Nov-14 1:06am
My vote of #3. It's not "harmful" to give broad, correct, information about how new Controls are created and added to the Control Collection of a Form, or other Container Control, but, in this case, there's not one iota of assistance with what the user is trying to do which is to create a kind of "design surface" onto which, at run-time, they will ... as in Visual Studio at design-time ... drag some graphic representation (icon, picture) onto the surface and ... we really don't know yet ... probably create some functionality that then is "brought to life."

It's the "And so on ..." that is important here
I simply can not understand your considerations. Do you understand them yourself? :-)

But I do see some problem with this answer: after your comments, I realized that my assumption that this is System.Window.Forms application, but for other libraries, my advice should be formulated in a considerably different way. However, "not one iota of assistance" is at least strange. It's possible that you did not understand the idea, which would be my fault...


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900