Sounds really retarded but I'm wanting to create an application that when ran the user can create an instance of lets say a button by clicking on the button that I have drawn on the screen.

It's going to be an application builder programs.

What I need to know is how can one build an app that can create instances of buttons and text boxes, after the program has been compiled?

Do I need to include the classes for each tool type into the .exe somewhere do I need to create an entirely new class for each button, label, etc?

Was hoping that I could use the pre existing classes built for those tool types and put my own custom tweak on the class after the button is built so that the user doesn't have to write any code for the button because each button will do one type of operation that is sequential for the life of the app.


Thanks for any input you can help me with and sorry for the murky post.

Here's a screen shot of the app in development so it may help give you a better understand at the what hey I'm talking about.

http://i51.tinypic.com/33a3r53.jpg

Sounds really retarded but I'm wanting to create an application that when ran the user can create an instance of lets say a button by clicking on the button that I have drawn on the screen.

It's going to be an application builder programs.

What I need to know is how can one build an app that can create instances of buttons and text boxes, after the program has been compiled?

Do I need to include the classes for each tool type into the .exe somewhere do I need to create an entirely new class for each button, label, etc?

Was hoping that I could use the pre existing classes built for those tool types and put my own custom tweak on the class after the button is built so that the user doesn't have to write any code for the button because each button will do one type of operation that is sequential for the life of the app.


Thanks for any input you can help me with and sorry for the murky post.

Here's a screen shot of the app in development so it may help give you a better understand at the what hey I'm talking about.

http://i51.tinypic.com/33a3r53.jpg

public void AddButton(int x, int y, int width, int height, string text)
{    
      Button btnNew = new Button();
      btnNew.Location = new System.Drawing.Point(x, y);
      btnNew.Name = "btnNew";
      btnNew.Size = new System.Drawing.Size(width, height);
      btnNew.Text = text;

      this.Controls.Add(btnNew);
}

The above code will simply add a new button to the form that calls it.

Hope this helps you

-Matt

Yes and no...lol...first thanks for the speedy reply...it does create an instance of a button but only one time and the loading bar spins constantly so I'm scared if I run with this alone after tweaking the code it might cause some speed issues on the back end. But thank you so much because your gave me a another idea that I didn't think of where I can use your code to fuel the button. I might create a class using that info and try to draw off the class to create a new button. cross your finger...well..me at least...lol..thanks bro.

Yes and no...lol...first thanks for the speedy reply...it does create an instance of a button but only one time and the loading bar spins constantly so I'm scared if I run with this alone after tweaking the code it might cause some speed issues on the back end. But thank you so much because your gave me a another idea that I didn't think of where I can use your code to fuel the button. I might create a class using that info and try to draw off the class to create a new button. cross your finger...well..me at least...lol..thanks bro.

Glad I could help you a little, what you said about only creating 1 button made me test this again, I created a button with the following code

private void button1_Click(object sender, EventArgs e)
        {
            Random rng = new Random();
            for (int i = 0; i < 100; ++i)
            {
                Button btnnew = new Button();

                btnnew.Location = new Point(rng.Next(255), rng.Next(255));
                btnnew.Size = (new Size(20, 20));


                this.Controls.Add(btnnew);
            }

I didn't really see much lag with it until I rapidly clicked the button, had 1000's of buttons on there and no lag.

http://img15.imageshack.us/i/77129332.png/
^^ Lost count of how many times I pressed the button, but i think it was a lot ^^

-Matt

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.