+ 1

Cloning <User Control-Windows form>

Is there <user control-windows form> a need to do that when you pressed the button it was cloned and that the cloned form went down to the required distance down?

19th Jan 2020, 5:00 PM
olmtvck
olmtvck - avatar
6 Antworten
+ 1
That is really difficult in winform and easy in WPF. Create a usercontrol. Add this control dynamically to the form using the information in the link below https://stackoverflow.com/questions/58674619/how-to-create-dynamically-c-sharp-panels
19th Jan 2020, 10:05 PM
sneeze
sneeze - avatar
+ 2
Can you explain this in a other way, I have no idea what you want to achieve ?
19th Jan 2020, 9:27 PM
sneeze
sneeze - avatar
+ 2
sneeze I still do not know, since there is no way to check, there will be an opportunity to check, thank you)
19th Jan 2020, 10:33 PM
olmtvck
olmtvck - avatar
+ 1
sneeze It is required that when you click on the "+" button another such User Control forms appear, and the button "+" is moved down, under the new User Control. Here is the screen https://prntscr.com/qpyolo
19th Jan 2020, 9:50 PM
olmtvck
olmtvck - avatar
+ 1
sneeze Here are these codes to insert into button_click event: int x = 0; int y = 0; for ( int i = 0; i < contacts.Count; i++ ) { { var control = new PersonControl(contacts[i]); control.Location = new Point(x, y); panel.Controls.Add(control); y += control.Height; } ?
19th Jan 2020, 10:19 PM
olmtvck
olmtvck - avatar
+ 1
yes that should work. Except for the extra { brace behind the for-loop statement. Notice for database actions there are datagrids. Does it work, What do you see ?
19th Jan 2020, 10:27 PM
sneeze
sneeze - avatar