There actually are arrays of these things in the same code file. It stores the pointers of the individual labels (HWND) and in some operations uses Control.FromHandle to get back the control from them in a loop.
I actually got annoyed enough after posting this that I deleted this entire file and rewrote it all with proper data bound objects and a data grid, and shaved 600 lines of code off the project. The compiler thanked me.
first, it could be setButtonFont and take a signed integer as it changes all the font sizes by the same constant value. This would stop you needing to create fontSizeDown, fontSizeUpByFour and so on
second, it could be its own function so that other areas of the app can call it
38
u/Chips_100 Sep 01 '21
I can already smell the ButtonFontDown_Click method.
6
u/baszodani Sep 01 '21
I don't know c#, how can this be rewritten to be better? Would you put the UI components in an array or change a global setting?
2
u/WpGgs Sep 01 '21
Generated code ?
15
u/MurdoMaclachlan public boolean isInt(int i) { return true; } Sep 01 '21
Image Transcription: Code
I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!
2
u/betaking12 Sep 02 '21
I imagine the story behind this is one of desperation and unfamiliarity with the task at hand or the codebase or something.
or some weird technical issue that inspired a quick fix and a fear of arrays.
1
u/RedditAcc-92975 Sep 01 '21
Username checks out
0
u/[deleted] Sep 01 '21
[deleted] — view deleted comment