setting a new Form programmatically

jekain314

New member
Joined
Sep 24, 2023
Messages
1
Programming Experience
5-10
I have a Windows Form that I have set up by hand that includes a chart control.
Setting up the form by hand works great.

I want to set up the form programmatically with C# code to look the same as the by-hand form.
I used the Size property from the by-hand form properties as well as the chart Size from its properties.

When I do this programmatically, the sizes dont work correctly.
The Form and chart sizes are way too big.
The size below was taken from the by-hand form design.

SymbolProcessingForm = new Form();
SymbolProcessingForm.Size = new Size( 3500, 1747);
SymbolProcessingForm.Text = "Symbol Processing";
SymbolProcessingForm.ShowIcon = false;
SymbolProcessingForm.Paint += new System.Windows.Forms.PaintEventHandler(SymbolProcessingFormPaintEventHadler);
 
Try copying all the code from the designer generated code. It's possible that some other properties were set which is influencing the sizing of the control.
 
I find it better to blend the design approaches; I lay out most of a form visually, then use things like table layout panels etc, to do some programmatic addition of controls to forms
 

Latest posts

Back
Top Bottom