Click here to Skip to main content
15,921,646 members
Home / Discussions / C#
   

C#

 
GeneralRe: Getting this simple crypto function to work in c#? Pin
BobJanova10-Aug-11 8:22
BobJanova10-Aug-11 8:22 
GeneralRe: Getting this simple crypto function to work in c#? Pin
stephen.darling11-Aug-11 4:25
stephen.darling11-Aug-11 4:25 
QuestionGet div values Pin
Herboren9-Aug-11 9:40
Herboren9-Aug-11 9:40 
AnswerRe: Get div values Pin
BobJanova9-Aug-11 23:05
BobJanova9-Aug-11 23:05 
QuestionResetting a user control using the same instance Pin
MAW309-Aug-11 9:27
MAW309-Aug-11 9:27 
AnswerRe: Resetting a user control using the same instance Pin
BillWoodruff9-Aug-11 9:58
professionalBillWoodruff9-Aug-11 9:58 
GeneralRe: Resetting a user control using the same instance Pin
MAW309-Aug-11 10:35
MAW309-Aug-11 10:35 
AnswerRe: Resetting a user control using the same instance Pin
MicroVirus9-Aug-11 12:37
MicroVirus9-Aug-11 12:37 
Then you'll need to come up with a 'formula' for the 'optimal' size of each control.
A good start would be to take the client size area of the form that's available for the controls, then subtracting the left and right offset (the distance of the controls to the edges of the form).
Then you have the 'working area' that can be used for the controls. If you have N controls you want to place in a row, and X pixels spacing in between controls you have ControlWidth * N + X * (N - 1) == WorkingArea_Width. Solving for ControlWidth gives you the 'optimal' width of each control.

Then you just have to set the control size on each, for instance if you stored the dynamically created user controls in a list:
C#
private List<MyUserControl> mControls = null;
...
// Initialise controls at Form load (for instance)
mControls = new List<MyUserControl>();
...
// When you add a new usercontrol to the form also add it to the list
mControls.Add( myNewUserControl );
...
// Now finally, when resizing you can use the calculation as described above
// and set the control sizes for each control in the list (you'll have to work
// on the algorithm for this a bit, but it's easy)
foreach (MyUserControl ctrl in mControls)
{
  ...
  ctrl.Left = ..; Ctrl.Top = ..; Ctrl.Width = ..; Ctrl.Height = ..;
}


I hope I managed to properly explain what I mean.
GeneralRe: Resetting a user control using the same instance Pin
MAW309-Aug-11 13:13
MAW309-Aug-11 13:13 
GeneralRe: Resetting a user control using the same instance Pin
BillWoodruff9-Aug-11 14:54
professionalBillWoodruff9-Aug-11 14:54 
GeneralRe: Resetting a user control using the same instance Pin
MicroVirus10-Aug-11 3:15
MicroVirus10-Aug-11 3:15 
QuestionVisio Interop and C# Pin
USAFHokie809-Aug-11 7:53
USAFHokie809-Aug-11 7:53 
QuestionAdvice on building charts C#, ASP, etc. Pin
MAW309-Aug-11 7:31
MAW309-Aug-11 7:31 
AnswerRe: Advice on building charts C#, ASP, etc. Pin
Abhinav S9-Aug-11 7:39
Abhinav S9-Aug-11 7:39 
QuestionVS2010 "Unable to copy file..." With Custom Controls Pin
Matt U.9-Aug-11 7:26
Matt U.9-Aug-11 7:26 
AnswerRe: VS2010 "Unable to copy file..." With Custom Controls Pin
BillWoodruff9-Aug-11 8:44
professionalBillWoodruff9-Aug-11 8:44 
GeneralRe: VS2010 "Unable to copy file..." With Custom Controls Pin
Matt U.9-Aug-11 8:58
Matt U.9-Aug-11 8:58 
GeneralRe: VS2010 "Unable to copy file..." With Custom Controls Pin
BillWoodruff9-Aug-11 10:05
professionalBillWoodruff9-Aug-11 10:05 
GeneralRe: VS2010 "Unable to copy file..." With Custom Controls Pin
Matt U.9-Aug-11 10:12
Matt U.9-Aug-11 10:12 
GeneralRe: VS2010 "Unable to copy file..." With Custom Controls Pin
BillWoodruff9-Aug-11 14:58
professionalBillWoodruff9-Aug-11 14:58 
GeneralRe: VS2010 "Unable to copy file..." With Custom Controls Pin
Matt U.10-Aug-11 1:44
Matt U.10-Aug-11 1:44 
GeneralRe: VS2010 "Unable to copy file..." With Custom Controls Pin
BillWoodruff10-Aug-11 3:40
professionalBillWoodruff10-Aug-11 3:40 
GeneralRe: VS2010 "Unable to copy file..." With Custom Controls Pin
Matt U.10-Aug-11 5:28
Matt U.10-Aug-11 5:28 
QuestionSQL server's Bigint in C# Pin
vanikanc9-Aug-11 6:00
vanikanc9-Aug-11 6:00 
AnswerRe: SQL server's Bigint in C# Pin
Shameel9-Aug-11 6:06
professionalShameel9-Aug-11 6:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.