adding support for high res monitors (dpi awareness)
This commit is contained in:
parent
9d78b15695
commit
5f330ddb82
3 changed files with 42 additions and 1 deletions
|
|
@ -246,7 +246,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
double sliderThumbWidth = 10 * GuiWidget.DeviceScale;
|
||||
double sliderWidth = 100 * GuiWidget.DeviceScale;
|
||||
var textSizeSlider = new SolidSlider(new Vector2(), sliderThumbWidth, theme, .7, 1.4)
|
||||
var textSizeSlider = new SolidSlider(new Vector2(), sliderThumbWidth, theme, .7, 2.5)
|
||||
{
|
||||
Name = "Text Size Slider",
|
||||
Margin = new BorderDouble(5, 0),
|
||||
|
|
@ -334,6 +334,29 @@ namespace MatterHackers.MatterControl
|
|||
}),
|
||||
advancedPanel);
|
||||
|
||||
// Touch Screen Mode
|
||||
this.AddSettingsRow(
|
||||
new SettingsItem(
|
||||
"Utilize High Res Monitors".Localize(),
|
||||
theme,
|
||||
new SettingsItem.ToggleSwitchConfig()
|
||||
{
|
||||
Checked = UserSettings.Instance.get(UserSettingsKey.ApplicationDpiAwareness) == "PerMonitorAware",
|
||||
ToggleAction = (itemChecked) =>
|
||||
{
|
||||
string dpiAwareness = itemChecked ? "PerMonitorAware" : "None";
|
||||
if (dpiAwareness != UserSettings.Instance.get(UserSettingsKey.ApplicationDpiAwareness))
|
||||
{
|
||||
UserSettings.Instance.set(UserSettingsKey.ApplicationDpiAwareness, dpiAwareness);
|
||||
StyledMessageBox.ShowMessageBox(
|
||||
"To finish changing your monitor settings you need to restart MatterControl. If after changing your fonts are too small you can adjust Text Size.".Localize(),
|
||||
"Restart Required".Localize());
|
||||
UiThread.RunOnIdle(() => ApplicationController.Instance.ReloadAll().ConfigureAwait(false));
|
||||
}
|
||||
}
|
||||
}),
|
||||
advancedPanel);
|
||||
|
||||
var openCacheButton = new IconButton(AggContext.StaticData.LoadIcon("fa-link_16.png", 16, 16, theme.InvertIcons), theme)
|
||||
{
|
||||
ToolTipText = "Open Folder".Localize(),
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ namespace MatterHackers.MatterControl
|
|||
public const string AfterPrintFinishedSendEmail = nameof(AfterPrintFinishedSendEmail);
|
||||
public const string AfterPrintFinishedSendTextMessage = nameof(AfterPrintFinishedSendTextMessage);
|
||||
public const string ApplicationDisplayMode = nameof(ApplicationDisplayMode);
|
||||
public const string ApplicationDpiAwareness = nameof(ApplicationDpiAwareness);
|
||||
public const string ApplicationTextSize = nameof(ApplicationTextSize);
|
||||
public const string ColorPanelExpanded = nameof(ColorPanelExpanded);
|
||||
public const string ConfigurePrinter_CurrentTab = nameof(ConfigurePrinter_CurrentTab);
|
||||
|
|
|
|||
17
Program.cs
17
Program.cs
|
|
@ -31,6 +31,7 @@ using System;
|
|||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.ServiceModel;
|
||||
using System.ServiceModel.Description;
|
||||
using System.Threading;
|
||||
|
|
@ -59,6 +60,17 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
private const string ServiceBaseUri = "net.pipe://localhost/mattercontrol";
|
||||
|
||||
[DllImport("Shcore.dll")]
|
||||
static extern int SetProcessDpiAwareness(int PROCESS_DPI_AWARENESS);
|
||||
|
||||
// According to https://msdn.microsoft.com/en-us/library/windows/desktop/dn280512(v=vs.85).aspx
|
||||
private enum DpiAwareness
|
||||
{
|
||||
None = 0,
|
||||
SystemAware = 1,
|
||||
PerMonitorAware = 2
|
||||
}
|
||||
|
||||
[STAThread]
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
|
|
@ -155,6 +167,11 @@ namespace MatterHackers.MatterControl
|
|||
Directory.SetCurrentDirectory(Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location));
|
||||
|
||||
Datastore.Instance.Initialize(DesktopSqlite.CreateInstance());
|
||||
|
||||
if (UserSettings.Instance.get(UserSettingsKey.ApplicationDpiAwareness) == "PerMonitorAware")
|
||||
{
|
||||
SetProcessDpiAwareness((int)DpiAwareness.PerMonitorAware);
|
||||
}
|
||||
#if !DEBUG
|
||||
// Conditionally spin up error reporting if not on the Stable channel
|
||||
string channel = UserSettings.Instance.get(UserSettingsKey.UpdateFeedType);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue