Skip to main content
Code Review

Return to Answer

added 20 characters in body
Source Link
ferada
  • 11.4k
  • 25
  • 65

In my eyes it is an appropriated way to build up your form that way. The *.Designer file is for designer generated code - but if you need to add custom logic to modify your GUI the *.cs file is the correct location.

Just a few points:

  • There are some numbers (115, 70, 35, ...) that seems to have a special meening (e.g. row height, margin, whatever). IMHO it makes sense to store that numbers as constants with a meaningful name and use that constants instead.

  • I am not sure if the MouseUp event is the right place to trigger that kind of logic. If there is another event (CheckBoxChanged, SelectedItemChanged, ...) I would suggest to use that.

  • There is some repeating logic for creating the ComboBox / Label and so on. That logic could be extracted to a separted method. For instance:

     private static ComboBox CreateComboBox()
     {
     return new ComboBox()
     {
     Font = new Font("Arial", 12F, FontStyle.Regular)
     Size = new Size(200, 22)
     DropDownStyle = ComboBoxStyle.DropDownList
     }
     }
    

private static ComboBox CreateComboBox()
{ 
 return new ComboBox()
 {
 Font = new Font("Arial", 12F, FontStyle.Regular)
 Size = new Size(200, 22)
 DropDownStyle = ComboBoxStyle.DropDownList
 }
}

In my eyes it is an appropriated way to build up your form that way. The *.Designer file is for designer generated code - but if you need to add custom logic to modify your GUI the *.cs file is the correct location.

Just a few points:

  • There are some numbers (115, 70, 35, ...) that seems to have a special meening (e.g. row height, margin, whatever). IMHO it makes sense to store that numbers as constants with a meaningful name and use that constants instead.

  • I am not sure if the MouseUp event is the right place to trigger that kind of logic. If there is another event (CheckBoxChanged, SelectedItemChanged, ...) I would suggest to use that.

  • There is some repeating logic for creating the ComboBox / Label and so on. That logic could be extracted to a separted method. For instance:

private static ComboBox CreateComboBox()
{ 
 return new ComboBox()
 {
 Font = new Font("Arial", 12F, FontStyle.Regular)
 Size = new Size(200, 22)
 DropDownStyle = ComboBoxStyle.DropDownList
 }
}

In my eyes it is an appropriated way to build up your form that way. The *.Designer file is for designer generated code - but if you need to add custom logic to modify your GUI the *.cs file is the correct location.

Just a few points:

  • There are some numbers (115, 70, 35, ...) that seems to have a special meening (e.g. row height, margin, whatever). IMHO it makes sense to store that numbers as constants with a meaningful name and use that constants instead.

  • I am not sure if the MouseUp event is the right place to trigger that kind of logic. If there is another event (CheckBoxChanged, SelectedItemChanged, ...) I would suggest to use that.

  • There is some repeating logic for creating the ComboBox / Label and so on. That logic could be extracted to a separted method. For instance:

     private static ComboBox CreateComboBox()
     {
     return new ComboBox()
     {
     Font = new Font("Arial", 12F, FontStyle.Regular)
     Size = new Size(200, 22)
     DropDownStyle = ComboBoxStyle.DropDownList
     }
     }
    

In my eyes it is an appropriated way to build up your form that way. The *.DesingerDesigner file is for designer generated code - but if you need to add custom logic to modify your GUI the *.cs file is the correct location.

Just a few points:

  • There are some numbers (115, 70, 35, ...) that seems to have a special meening (e.g. row height, margin, whatever). IMHO it makes sense to store that numbers as constants with a meaningful name and use that constants instead.

  • I am not sure if the MouseUp event is the right place to trigger that kind of logic. If there is another event (CheckBoxChanged, SelectedItemChanged, ...) I would suggest to use that.

  • There is some repeating logic for creating the ComboBox / Label and so on. That logic could be extracted to a separted method. For instance:

_

private static ComboBox CreateComboBox()
{ 
 return new ComboBox()
 {
 Font = new Font("Arial", 12F, FontStyle.Regular)
 Size = new Size(200, 22)
 DropDownStyle = ComboBoxStyle.DropDownList
 }
}

In my eyes it is an appropriated way to build up your form that way. The *.Desinger file is for designer generated code - but if you need to add custom logic to modify your GUI the *.cs file is the correct location.

Just a few points:

  • There are some numbers (115, 70, 35, ...) that seems to have a special meening (e.g. row height, margin, whatever). IMHO it makes sense to store that numbers as constants with a meaningful name and use that constants instead.

  • I am not sure if the MouseUp event is the right place to trigger that kind of logic. If there is another event (CheckBoxChanged, SelectedItemChanged, ...) I would suggest to use that.

  • There is some repeating logic for creating the ComboBox / Label and so on. That logic could be extracted to a separted method. For instance:

_

private static ComboBox CreateComboBox()
{ 
 return new ComboBox()
 {
 Font = new Font("Arial", 12F, FontStyle.Regular)
 Size = new Size(200, 22)
 DropDownStyle = ComboBoxStyle.DropDownList
 }
}

In my eyes it is an appropriated way to build up your form that way. The *.Designer file is for designer generated code - but if you need to add custom logic to modify your GUI the *.cs file is the correct location.

Just a few points:

  • There are some numbers (115, 70, 35, ...) that seems to have a special meening (e.g. row height, margin, whatever). IMHO it makes sense to store that numbers as constants with a meaningful name and use that constants instead.

  • I am not sure if the MouseUp event is the right place to trigger that kind of logic. If there is another event (CheckBoxChanged, SelectedItemChanged, ...) I would suggest to use that.

  • There is some repeating logic for creating the ComboBox / Label and so on. That logic could be extracted to a separted method. For instance:

private static ComboBox CreateComboBox()
{ 
 return new ComboBox()
 {
 Font = new Font("Arial", 12F, FontStyle.Regular)
 Size = new Size(200, 22)
 DropDownStyle = ComboBoxStyle.DropDownList
 }
}
added even more code formatting
Source Link
t3chb0t
  • 44.6k
  • 9
  • 84
  • 190

In my eyes it is an appropriated way to build up your form that way. The *.Desinger*.Desinger file is for designer generated code - but if you need to add custom logic to modify your GUI the *.cs*.cs file is the correct location.

Just a few points:

  • There are some numbers (115, 70, 35, ...) that seems to have a special meening (e.g. row height, margin, whatever). IMHO it makes sense to store that numbers as constants with a meaningful name and use that constants instead.

  • I am not sure if the MouseUp event is the right place to trigger that kind of logic. If there is another event (CheckBoxChangedCheckBoxChanged, SelectedItemChangedSelectedItemChanged, ...) I would suggest to use that.

  • There is some repeating logic for creating the combobx ComboBox/ lableLabel and so on. That logic could be extracted to a separted method. For instance:

_

private static ComboBox CreateComboBox()
{ 
 return new ComboBox()
 {
 Font = new Font("Arial", 12F, FontStyle.Regular)
 Size = new Size(200, 22)
 DropDownStyle = ComboBoxStyle.DropDownList
 }
}

In my eyes it is an appropriated way to build up your form that way. The *.Desinger file is for designer generated code - but if you need to add custom logic to modify your GUI the *.cs file is the correct location.

Just a few points:

  • There are some numbers (115, 70, 35, ...) that seems to have a special meening (e.g. row height, margin, whatever). IMHO it makes sense to store that numbers as constants with a meaningful name and use that constants instead.

  • I am not sure if the MouseUp event is the right place to trigger that kind of logic. If there is another event (CheckBoxChanged, SelectedItemChanged, ...) I would suggest to use that.

  • There is some repeating logic for creating the combobx / lable and so on. That logic could be extracted to a separted method. For instance:

_

private static ComboBox CreateComboBox()
{ 
 return new ComboBox()
 {
 Font = new Font("Arial", 12F, FontStyle.Regular)
 Size = new Size(200, 22)
 DropDownStyle = ComboBoxStyle.DropDownList
 }
}

In my eyes it is an appropriated way to build up your form that way. The *.Desinger file is for designer generated code - but if you need to add custom logic to modify your GUI the *.cs file is the correct location.

Just a few points:

  • There are some numbers (115, 70, 35, ...) that seems to have a special meening (e.g. row height, margin, whatever). IMHO it makes sense to store that numbers as constants with a meaningful name and use that constants instead.

  • I am not sure if the MouseUp event is the right place to trigger that kind of logic. If there is another event (CheckBoxChanged, SelectedItemChanged, ...) I would suggest to use that.

  • There is some repeating logic for creating the ComboBox/ Label and so on. That logic could be extracted to a separted method. For instance:

_

private static ComboBox CreateComboBox()
{ 
 return new ComboBox()
 {
 Font = new Font("Arial", 12F, FontStyle.Regular)
 Size = new Size(200, 22)
 DropDownStyle = ComboBoxStyle.DropDownList
 }
}
Source Link
JanDotNet
  • 8.6k
  • 2
  • 21
  • 48
Loading
lang-cs

AltStyle によって変換されたページ (->オリジナル) /