mirror of
https://github.com/greenshot/greenshot
synced 2025-07-16 10:03:44 -07:00
More DPI fixes, now supporting windows with different DPI settings.
This commit is contained in:
parent
efb4c997d4
commit
d81d0ad4f1
8 changed files with 814 additions and 27 deletions
|
@ -316,18 +316,20 @@ namespace Greenshot {
|
|||
// Timer for the double click test
|
||||
private readonly Timer _doubleClickTimer = new Timer();
|
||||
|
||||
public MainForm(CopyDataTransport dataTransport) {
|
||||
public MainForm(CopyDataTransport dataTransport) {
|
||||
DpiChanged += (e,o) => ApplyDpiScaling();
|
||||
|
||||
// The most important form is this
|
||||
SimpleServiceProvider.Current.AddService<Form>(this);
|
||||
// Also as itself
|
||||
SimpleServiceProvider.Current.AddService(this);
|
||||
SimpleServiceProvider.Current.AddService(this);
|
||||
|
||||
_instance = this;
|
||||
|
||||
// Factory for surface objects
|
||||
ISurface SurfaceFactory() => new Surface();
|
||||
ISurface SurfaceFactory() => new Surface();
|
||||
|
||||
SimpleServiceProvider.Current.AddService((Func<ISurface>) SurfaceFactory);
|
||||
SimpleServiceProvider.Current.AddService((Func<ISurface>) SurfaceFactory);
|
||||
|
||||
//
|
||||
// The InitializeComponent() call is required for Windows Forms designer support.
|
||||
|
@ -559,8 +561,9 @@ namespace Greenshot {
|
|||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void OnIconSizeChanged(object sender, PropertyChangedEventArgs e) {
|
||||
if (e.PropertyName == "IconSize") {
|
||||
contextMenu.ImageScalingSize = coreConfiguration.ScaledIconSize;
|
||||
if (e.PropertyName == "IconSize")
|
||||
{
|
||||
ApplyDpiScaling();
|
||||
string ieExePath = PluginUtils.GetExePath("iexplore.exe");
|
||||
if (!string.IsNullOrEmpty(ieExePath)) {
|
||||
contextmenu_captureie.Image = PluginUtils.GetCachedExeIcon(ieExePath, 0);
|
||||
|
@ -568,6 +571,15 @@ namespace Greenshot {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Modify the DPI settings depending in the current value
|
||||
/// </summary>
|
||||
private void ApplyDpiScaling()
|
||||
{
|
||||
var scaledIconSize = DpiHelper.ScaleWithDpi(coreConfiguration.IconSize, DpiHelper.GetDpi(Handle));
|
||||
contextMenu.ImageScalingSize = scaledIconSize;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers all hotkeys as configured, displaying a dialog in case of hotkey conflicts with other tools.
|
||||
/// </summary>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue