tags:

views:

560

answers:

1

windows form application I want desine keypad like pda device .I want all numeric keys in one group therfore I want to arrange all these button on one frame or panel . second frame or panel which contain all the special function keys . I want design this keyboard at runtime after reading xml file description of keypad. please guide me to implement this.

+2  A: 

Short version of adding a control to a container (Button used as example):

   Button myButton = new Button();
   myButton.Text = "some text";
   // attach event handler for Click event 
   // (assuming ButtonClickHandler is an existing method in the class)
   myButton.Click += ButtonClickHandler;
   myPanel.Controls.Add(myButton);
   // additional code for setting location and such for myButton

The tricky part will probably not be to create the controls and add them to the container, but to arrange them so that it looks good.

Fredrik Mörk
Dynamically adding controls to a form can indeed be a layout nightmare; fortunately, there's the TableLayoutPanel control to make things (a bit) easier.
Dan Tao