|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
96 <---> DPI, scaling and StatusStrip bug ???I want to support laptops as well and a lot of them have DPI set to 120 ...this is still a nightmare for me to scale ...if simply set the form's AutoSize = true after InitializeComponent(); ....this seems to fix most scaling problems, but if there's a StatusStrip on the bottom, the forms height still doesn't seem to take this into account and my buttons on the bottom appear to get hidden under the strip. To get around it, i've done this hack: public void AutoScale(Form oForm, StatusStrip oStatusStrip) { oForm.AutoScaleMode = AutoScaleMode.Dpi; SizeF sf = oForm.CurrentAutoScaleDimensions; if (sf.Width > 96) // check for non-standard 96 DPI mode { int nHeight = oForm.ClientSize.Height; int nWidth = oForm.ClientSize.Width; oForm.ClientSize = new System.Drawing.Size(nWidth, nHeight + oStatusStrip.Height); oForm.AutoSize = true; } } ....i put this in a generic class and after every: InitializeComponent(); in my form class with a statusStrip control, i call this, else, i just do a: AutoSize = true ....this seems to work, but don't think it's the best or proper way (?) Any ideas ? ...thanks |
|||||||||||||||||||||||