THis is a followup to my previous question "Font-dependent control positioning." It's an attempt to solve the real problem behind that question, perhaps in ways different than the one I was asking about.
Example of the problem statement: I want a checkbox that says "Adjust prices by <X> <Y> after loading," where <X> is a number---adjustable with a NumericUpDown
---and <Y> is either "percent" or "dollars," with the choices being made by a ComboBox
. This will be on a single line.
The complication: I want to be able to change my fonts for all these controls (basically setting them to System.Drawing.Fonts.MessageBoxFont
, which is Tahoma 8 pt on Windows XP/etc. and Segoe UI 9 pt on Vista), without messing up my layout, which with my current Position
-property--setting paradigm does not work.
More generally, I'd like the controls to be dynamically laid out in a font-independent way, so that the <X> NumericUpDown
fits snugly into the space between "by " and the <Y> ComboBox
, and similarly the <X> ComboBox
fits in with respect to the <X> CheckBox
and the string " after loading" to its right.
The part everyone seems to miss: This is all nested within a CheckBox
. So, ideally, clicking on the words "after loading" should check/uncheck the checkbox, and draw that little highlight rectangle around "Adjust prices by after loading." So just slapping an extra Label
on the end doesn't work, because then it doesn't toggle the CheckBox
; similarly, trying to band-aid things by hooking up such a Label
's Click
event won't produce the desired highlight-rectangle.
Solutions? At this point I'm thinking either:
Rethink the problem, somehow, maybe with an ugly solution like two separate lines of text: "Adjust found prices after loading" (
CheckBox
), "Adjustment amount:" (NumericUpDown
andComboBox
). This is really bad because my options box is absolutely full of options of this type (i.e. the type in the example), so it would at least double in vertical size.Some sort of custom control?
SplittableCheckBox
?Some kind of magic with a
TableLayout
control? (Pretty sure this fails at "the part everyone seems to miss.)Give up and either go back to MS Sans Serif, or use Tahoma uniformly, or package Segoe UI with my application, thus disrespecting the system default fonts.
(New, via edit) Switch to WPF, if someone can convince me that it supports this scenario exactly.