Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everyone,

I add new simple button on my form

ArrayList  a=new ArrayList ();
  int counter;

 void x()
       {
            a.Add(new SimpleButton());
           propertyGridControl1.SelectedObject = ((SimpleButton)a[counter]);
           ((SimpleButton )a[counter]).Height =10;
           ((SimpleButton)a[counter ]).Width = 10;
           ((SimpleButton)a[counter]).Text = "mo";
           ((SimpleButton)a[counter]).Parent = pictureEdit1;
           ((SimpleButton)a[counter]).Location = new Point(10, 10);
             counter = +1;
       }

Ok I want so when I press click on a[counter] I show the message box and have ability to move this a[counter] to any place with mouse click move on picture Parent
ok \
thanks for any help
Posted
Updated 16-Jan-11 5:06am
v4
Comments
Abhishek Sur 16-Jan-11 8:10am    
Are you trying to drag and drop the DevExpress SimpleButton on the form ?
Dalek Dave 16-Jan-11 11:09am    
Edited for Grammar

I'm not exactly sure what you are trying to achieve, but lookat your code fragment, I'm not sure you are either.

What you have done does not add a button to your form. It adds a SimpleButton (which I assume is a class you have defined) to an ArrayList, but not to your form.
It then sets a counter to one.

To add a button to your form at run time:
Button myButton = new Button();
myButton.Height =10;
myButton.Width = 10;
myButton.Text = "mo";
myButton.Location = new Point(10, 10); 
Controls.Add(myButton);

I assume that you also wanted to increment the count. If so then use one of these forms:
counter += 1;

counter = counter + 1;

counter++;

I would also not refer to "Parent" for a control, unless I really had to - it makes the control need to know about what contains it, rather than an object knowing about what it contains.

As for the rest "move this a[counter ] to any place with mouse click move on picture Parent" please try to give more info on what you are trying to achieve.
 
Share this answer
 
Comments
Manfred Rudolf Bihy 16-Jan-11 7:53am    
Good call! 5+
Dalek Dave 16-Jan-11 11:10am    
Good Answer
Sergey Alexandrovich Kryukov 16-Jan-11 14:09pm    
Makes sense - a 5.
Here is one way to achieve the movement part:
User-driven applications[^].

When you have read and understood the article - the rest shouldn't be much of a problem.

I guess you are using DevExpress Property Grid Control[^] so this article should be of interest: Have a Great DesignTime Experience with a Powerful DesignSurface (Extended) Class[^] - not on the DevExpress components, but shows how something similar to the layout controls (the customize part) could be done using DesignSurface.

You could also use the DevExpress Layout Manager Controls for Windows Forms[^] - most, if not all, of what you need is included with the examples :)

Basically a good collection of links - and with a bit of reading you should be able to make a wonderful UI.

Good luck!

Regards
Espen Harlinn
 
Share this answer
 
v4
Comments
Dalek Dave 16-Jan-11 11:10am    
Good Answer
Sergey Alexandrovich Kryukov 16-Jan-11 14:10pm    
Going above the question is good - a 5.
Espen Harlinn 16-Jan-11 15:15pm    
Thanks!!

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