1.1 --- a/GUI/SensorGadget.cs Thu Jan 27 22:29:43 2011 +0000
1.2 +++ b/GUI/SensorGadget.cs Sun Jan 30 23:45:26 2011 +0000
1.3 @@ -54,6 +54,7 @@
1.4 private const int leftBorder = 6;
1.5 private const int rightBorder = 7;
1.6
1.7 + private readonly float scale;
1.8 private float fontSize;
1.9 private int iconSize;
1.10 private int hardwareLineHeight;
1.11 @@ -108,6 +109,11 @@
1.12 settings.SetValue("sensorGadget.Location.Y", Location.Y);
1.13 };
1.14
1.15 + // get the custom to default dpi ratio
1.16 + using (Bitmap b = new Bitmap(1, 1)) {
1.17 + scale = b.HorizontalResolution / 96.0f;
1.18 + }
1.19 +
1.20 SetFontSize(settings.GetValue("sensorGadget.FontSize", 7.5f));
1.21 Resize(settings.GetValue("sensorGadget.Width", Size.Width));
1.22
1.23 @@ -329,15 +335,18 @@
1.24 fontSize = size;
1.25 largeFont = CreateFont(fontSize, FontStyle.Bold);
1.26 smallFont = CreateFont(fontSize, FontStyle.Regular);
1.27 - iconSize = (int)Math.Round(1.5 * fontSize);
1.28 - hardwareLineHeight = (int)Math.Round(1.66 * fontSize);
1.29 - sensorLineHeight = (int)Math.Round(1.33 * fontSize);
1.30 - leftMargin = leftBorder + (int)Math.Round(0.3 * fontSize);
1.31 - rightMargin = rightBorder + (int)Math.Round(0.3 * fontSize);
1.32 +
1.33 + double scaledFontSize = fontSize * scale;
1.34 + iconSize = (int)Math.Round(1.5 * scaledFontSize);
1.35 + hardwareLineHeight = (int)Math.Round(1.66 * scaledFontSize);
1.36 + sensorLineHeight = (int)Math.Round(1.33 * scaledFontSize);
1.37 + leftMargin = leftBorder + (int)Math.Round(0.3 * scaledFontSize);
1.38 + rightMargin = rightBorder + (int)Math.Round(0.3 * scaledFontSize);
1.39 topMargin = topBorder;
1.40 - bottomMargin = bottomBorder + (int)Math.Round(0.3 * fontSize);
1.41 - progressWidth = (int)Math.Round(5.3 * fontSize);
1.42 - Resize((int)Math.Round(17.3 * fontSize));
1.43 + bottomMargin = bottomBorder + (int)Math.Round(0.3 * scaledFontSize);
1.44 + progressWidth = (int)Math.Round(5.3 * scaledFontSize);
1.45 +
1.46 + Resize((int)Math.Round(17.3 * scaledFontSize));
1.47 }
1.48
1.49 private void Resize() {