Improving the DPI handling for most forms, there are still issues with:

* the AboutForm.Designer.cs where the title with the version scales differently.
* the destination picker doesn't seem to scale the font correctly.
Some parts are not tested yet...
This commit is contained in:
Robin Krom 2020-10-12 23:44:27 +02:00
commit 21be3a93a5
36 changed files with 209 additions and 209 deletions

View file

@ -4,7 +4,10 @@
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<runtime>
<System.Windows.Forms.ApplicationConfigurationSection>
<add key="DpiAwareness" value="PerMonitorV2" />
</System.Windows.Forms.ApplicationConfigurationSection>
<runtime>
<loadFromRemoteSources enabled="true" />
<relativeBindForResources enabled="true" />
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

View file

@ -67,7 +67,7 @@ namespace Greenshot.Forms {
//
// lblTitle
//
this.lblTitle.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblTitle.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.World, ((byte)(0)));
this.lblTitle.Location = new System.Drawing.Point(108, 12);
this.lblTitle.Name = "lblTitle";
this.lblTitle.Size = new System.Drawing.Size(263, 19);
@ -195,8 +195,11 @@ namespace Greenshot.Forms {
//
// AboutForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
//this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
//this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoScaleDimensions = new System.Drawing.SizeF(96, 96);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(530, 293);
this.Controls.Add(this.lblTranslation);
this.Controls.Add(this.pictureBox1);

View file

@ -55,8 +55,8 @@ namespace Greenshot.Forms {
//
// CaptureForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(0, 0);
this.Cursor = System.Windows.Forms.Cursors.Cross;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;

View file

@ -105,7 +105,6 @@ namespace Greenshot.Forms {
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(153, 35);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(14, 13);
@ -166,7 +165,6 @@ namespace Greenshot.Forms {
//
// labelDarkness
//
this.labelDarkness.AutoSize = true;
this.labelDarkness.LanguageKey = "editor_dropshadow_darkness";
this.labelDarkness.Location = new System.Drawing.Point(12, 73);
this.labelDarkness.Name = "labelDarkness";
@ -175,7 +173,6 @@ namespace Greenshot.Forms {
//
// labelOffset
//
this.labelOffset.AutoSize = true;
this.labelOffset.LanguageKey = "editor_dropshadow_offset";
this.labelOffset.Location = new System.Drawing.Point(12, 35);
this.labelOffset.Name = "labelOffset";
@ -184,7 +181,6 @@ namespace Greenshot.Forms {
//
// labelThickness
//
this.labelThickness.AutoSize = true;
this.labelThickness.LanguageKey = "editor_dropshadow_thickness";
this.labelThickness.Location = new System.Drawing.Point(12, 9);
this.labelThickness.Name = "labelThickness";
@ -194,8 +190,8 @@ namespace Greenshot.Forms {
// DropShadowSettingsForm
//
this.AcceptButton = this.buttonOK;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.CancelButton = this.buttonCancel;
this.ClientSize = new System.Drawing.Size(230, 154);
this.ControlBox = false;

View file

@ -102,13 +102,12 @@ namespace Greenshot {
propertiesToolStrip.ImageScalingSize = newSize;
propertiesToolStrip.MinimumSize = new Size(150, newSize.Height + 10);
_surface.AdjustToDpi(dpi);
_surface?.AdjustToDpi(dpi);
UpdateUi();
}
public ImageEditorForm(ISurface iSurface, bool outputMade)
{
// Make sure we change the icon size depending on the scaling
DpiChanged += AdjustToDpi;
EditorList.Add(this);
//
@ -116,6 +115,8 @@ namespace Greenshot {
//
ManualLanguageApply = true;
InitializeComponent();
// Make sure we change the icon size depending on the scaling
DpiChanged += AdjustToDpi;
Load += delegate {
var thread = new Thread(AddDestinations)
{
@ -236,7 +237,10 @@ namespace Greenshot {
MouseWheel += PanelMouseWheel;
// Make sure the value is set correctly when starting
counterUpDown.Value = Surface.CounterStart;
if (Surface != null)
{
counterUpDown.Value = Surface.CounterStart;
}
ApplyLanguage();
}

View file

@ -50,31 +50,30 @@ namespace Greenshot {
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
this.contextMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
this.contextmenu_capturearea = new GreenshotPlugin.Controls.GreenshotToolStripMenuItem();
this.contextmenu_capturearea = new GreenshotPlugin.Controls.GreenshotToolStripMenuItem();
this.contextmenu_capturelastregion = new GreenshotPlugin.Controls.GreenshotToolStripMenuItem();
this.contextmenu_capturewindow = new GreenshotPlugin.Controls.GreenshotToolStripMenuItem();
this.contextmenu_capturefullscreen = new GreenshotPlugin.Controls.GreenshotToolStripMenuItem();
this.contextmenu_captureie = new GreenshotPlugin.Controls.GreenshotToolStripMenuItem();
this.toolStripListCaptureSeparator = new System.Windows.Forms.ToolStripSeparator();
this.contextmenu_capturewindowfromlist = new GreenshotPlugin.Controls.GreenshotToolStripMenuItem();
this.contextmenu_captureiefromlist = new GreenshotPlugin.Controls.GreenshotToolStripMenuItem();
this.toolStripOtherSourcesSeparator = new System.Windows.Forms.ToolStripSeparator();
this.contextmenu_captureclipboard = new GreenshotPlugin.Controls.GreenshotToolStripMenuItem();
this.contextmenu_openfile = new GreenshotPlugin.Controls.GreenshotToolStripMenuItem();
this.toolStripOpenFolderSeparator = new System.Windows.Forms.ToolStripSeparator();
this.contextmenu_openrecentcapture = new GreenshotPlugin.Controls.GreenshotToolStripMenuItem();
this.toolStripPluginSeparator = new System.Windows.Forms.ToolStripSeparator();
this.contextmenu_quicksettings = new GreenshotPlugin.Controls.GreenshotToolStripMenuItem();
this.contextmenu_settings = new GreenshotPlugin.Controls.GreenshotToolStripMenuItem();
this.toolStripMiscSeparator = new System.Windows.Forms.ToolStripSeparator();
this.contextmenu_help = new GreenshotPlugin.Controls.GreenshotToolStripMenuItem();
this.contextmenu_donate = new GreenshotPlugin.Controls.GreenshotToolStripMenuItem();
this.contextmenu_about = new GreenshotPlugin.Controls.GreenshotToolStripMenuItem();
this.contextmenu_exit = new GreenshotPlugin.Controls.GreenshotToolStripMenuItem();
this.toolStripListCaptureSeparator = new System.Windows.Forms.ToolStripSeparator();
this.toolStripOtherSourcesSeparator = new System.Windows.Forms.ToolStripSeparator();
this.toolStripOpenFolderSeparator = new System.Windows.Forms.ToolStripSeparator();
this.toolStripPluginSeparator = new System.Windows.Forms.ToolStripSeparator();
this.toolStripMiscSeparator = new System.Windows.Forms.ToolStripSeparator();
this.toolStripCloseSeparator = new System.Windows.Forms.ToolStripSeparator();
this.contextmenu_exit = new GreenshotPlugin.Controls.GreenshotToolStripMenuItem();
this.notifyIcon = new System.Windows.Forms.NotifyIcon(this.components);
this.contextMenu.SuspendLayout();
this.SuspendLayout();
this.contextMenu.SuspendLayout();
this.SuspendLayout();
//
// contextMenu
//
@ -250,10 +249,11 @@ namespace Greenshot {
//
// notifyIcon
//
this.notifyIcon = new System.Windows.Forms.NotifyIcon(this.components);
this.notifyIcon.ContextMenuStrip = this.contextMenu;
this.notifyIcon.Text = "Greenshot";
this.notifyIcon.MouseUp += new System.Windows.Forms.MouseEventHandler(this.NotifyIconClickTest);
//
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);

View file

@ -245,7 +245,7 @@ namespace Greenshot {
return;
}
// Make sure we can use forms
WindowsFormsHost.EnableWindowsFormsInterop();
WindowsFormsHost.EnableWindowsFormsInterop();
// BUG-1809: Add message filter, to filter out all the InputLangChanged messages which go to a target control with a handle > 32 bit.
Application.AddMessageFilter(new WmInputLangChangeRequestFilter());
@ -744,7 +744,10 @@ namespace Greenshot {
}
private void ContextMenuOpening(object sender, CancelEventArgs e) {
private void ContextMenuOpening(object sender, CancelEventArgs e)
{
var factor = DeviceDpi / 96f;
contextMenu.Scale(new SizeF(factor,factor));
contextmenu_captureclipboard.Enabled = ClipboardHelper.ContainsImage();
contextmenu_capturelastregion.Enabled = coreConfiguration.LastCapturedRegion != Rectangle.Empty;
@ -1025,7 +1028,7 @@ namespace Greenshot {
/// <param name="e">EventArgs</param>
private void Contextmenu_DonateClick(object sender, EventArgs e) {
BeginInvoke((MethodInvoker)delegate {
Process.Start("http://getgreenshot.org/support/?version=" + Assembly.GetEntryAssembly().GetName().Version);
Process.Start("http://getgreenshot.org/support/?version=" + EnvironmentInfo.GetGreenshotVersion(true));
});
}

View file

@ -52,7 +52,6 @@ namespace Greenshot.Forms
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(40, 5);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(37, 13);
@ -69,7 +68,6 @@ namespace Greenshot.Forms
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(2, 37);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(33, 13);
@ -92,7 +90,6 @@ namespace Greenshot.Forms
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(2, 50);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(42, 13);
@ -108,7 +105,6 @@ namespace Greenshot.Forms
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(2, 63);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(34, 13);
@ -124,7 +120,6 @@ namespace Greenshot.Forms
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(2, 76);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(40, 13);
@ -156,8 +151,8 @@ namespace Greenshot.Forms
//
this.Visible = false;
this.Location = new System.Drawing.Point(-10000,-10000);
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(100, 100);
this.Controls.Add(this.panel1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;

View file

@ -68,7 +68,6 @@ namespace Greenshot.Forms
//
// checkbox_dontaskagain
//
this.checkbox_dontaskagain.AutoSize = true;
this.checkbox_dontaskagain.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkbox_dontaskagain.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkbox_dontaskagain.LanguageKey = "printoptions_dontaskagain";
@ -82,7 +81,6 @@ namespace Greenshot.Forms
//
// checkboxAllowShrink
//
this.checkboxAllowShrink.AutoSize = true;
this.checkboxAllowShrink.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxAllowShrink.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxAllowShrink.LanguageKey = "printoptions_allowshrink";
@ -97,7 +95,6 @@ namespace Greenshot.Forms
//
// checkboxAllowEnlarge
//
this.checkboxAllowEnlarge.AutoSize = true;
this.checkboxAllowEnlarge.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxAllowEnlarge.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxAllowEnlarge.LanguageKey = "printoptions_allowenlarge";
@ -112,7 +109,6 @@ namespace Greenshot.Forms
//
// checkboxAllowCenter
//
this.checkboxAllowCenter.AutoSize = true;
this.checkboxAllowCenter.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxAllowCenter.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxAllowCenter.LanguageKey = "printoptions_allowcenter";
@ -127,7 +123,6 @@ namespace Greenshot.Forms
//
// checkboxAllowRotate
//
this.checkboxAllowRotate.AutoSize = true;
this.checkboxAllowRotate.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxAllowRotate.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxAllowRotate.LanguageKey = "printoptions_allowrotate";
@ -155,7 +150,6 @@ namespace Greenshot.Forms
//
// checkboxDateTime
//
this.checkboxDateTime.AutoSize = true;
this.checkboxDateTime.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxDateTime.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxDateTime.LanguageKey = "printoptions_timestamp";
@ -182,7 +176,6 @@ namespace Greenshot.Forms
//
// checkboxPrintInverted
//
this.checkboxPrintInverted.AutoSize = true;
this.checkboxPrintInverted.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxPrintInverted.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxPrintInverted.LanguageKey = "printoptions_inverted";
@ -197,7 +190,6 @@ namespace Greenshot.Forms
//
// radioBtnGrayScale
//
this.radioBtnGrayScale.AutoSize = true;
this.radioBtnGrayScale.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.radioBtnGrayScale.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.radioBtnGrayScale.LanguageKey = "printoptions_printgrayscale";
@ -212,7 +204,6 @@ namespace Greenshot.Forms
//
// radioBtnMonochrome
//
this.radioBtnMonochrome.AutoSize = true;
this.radioBtnMonochrome.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.radioBtnMonochrome.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.radioBtnMonochrome.LanguageKey = "printoptions_printmonochrome";
@ -227,7 +218,6 @@ namespace Greenshot.Forms
//
// groupBoxPrintLayout
//
this.groupBoxPrintLayout.AutoSize = true;
this.groupBoxPrintLayout.Controls.Add(this.checkboxDateTime);
this.groupBoxPrintLayout.Controls.Add(this.checkboxAllowShrink);
this.groupBoxPrintLayout.Controls.Add(this.checkboxAllowEnlarge);
@ -243,7 +233,6 @@ namespace Greenshot.Forms
//
// groupBoxColors
//
this.groupBoxColors.AutoSize = true;
this.groupBoxColors.Controls.Add(this.checkboxPrintInverted);
this.groupBoxColors.Controls.Add(this.radioBtnColorPrint);
this.groupBoxColors.Controls.Add(this.radioBtnGrayScale);
@ -258,7 +247,6 @@ namespace Greenshot.Forms
//
// radioBtnColorPrint
//
this.radioBtnColorPrint.AutoSize = true;
this.radioBtnColorPrint.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.radioBtnColorPrint.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.radioBtnColorPrint.LanguageKey = "printoptions_printcolor";
@ -274,7 +262,6 @@ namespace Greenshot.Forms
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.AutoSize = true;
this.ClientSize = new System.Drawing.Size(355, 390);
this.Controls.Add(this.groupBoxColors);
this.Controls.Add(this.groupBoxPrintLayout);

View file

@ -76,7 +76,6 @@ namespace Greenshot.Forms {
//
// checkbox_aspectratio
//
this.checkbox_aspectratio.AutoSize = true;
this.checkbox_aspectratio.LanguageKey = "editor_resize_aspectratio";
this.checkbox_aspectratio.Location = new System.Drawing.Point(22, 64);
this.checkbox_aspectratio.Name = "checkbox_aspectratio";
@ -86,7 +85,6 @@ namespace Greenshot.Forms {
//
// label_width
//
this.label_width.AutoSize = true;
this.label_width.LanguageKey = "editor_resize_width";
this.label_width.Location = new System.Drawing.Point(19, 15);
this.label_width.Name = "label_width";
@ -95,7 +93,6 @@ namespace Greenshot.Forms {
//
// label_height
//
this.label_height.AutoSize = true;
this.label_height.LanguageKey = "editor_resize_height";
this.label_height.Location = new System.Drawing.Point(19, 38);
this.label_height.Name = "label_height";
@ -140,8 +137,8 @@ namespace Greenshot.Forms {
// ResizeSettingsForm
//
this.AcceptButton = this.buttonOK;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.CancelButton = this.buttonCancel;
this.ClientSize = new System.Drawing.Size(244, 122);
this.ControlBox = false;

View file

@ -705,7 +705,6 @@ namespace Greenshot {
//
// colorButton_window_background
//
this.colorButton_window_background.AutoSize = true;
this.colorButton_window_background.Image = ((System.Drawing.Image)(resources.GetObject("colorButton_window_background.Image")));
this.colorButton_window_background.Location = new System.Drawing.Point(374, 37);
this.colorButton_window_background.Name = "colorButton_window_background";
@ -716,7 +715,6 @@ namespace Greenshot {
//
// radiobuttonWindowCapture
//
this.radiobuttonWindowCapture.AutoSize = true;
this.radiobuttonWindowCapture.LanguageKey = "settings_window_capture_mode";
this.radiobuttonWindowCapture.Location = new System.Drawing.Point(11, 44);
this.radiobuttonWindowCapture.Name = "radiobuttonWindowCapture";
@ -727,7 +725,6 @@ namespace Greenshot {
//
// radiobuttonInteractiveCapture
//
this.radiobuttonInteractiveCapture.AutoSize = true;
this.radiobuttonInteractiveCapture.LanguageKey = "settings_capture_windows_interactive";
this.radiobuttonInteractiveCapture.Location = new System.Drawing.Point(11, 20);
this.radiobuttonInteractiveCapture.Name = "radiobuttonInteractiveCapture";
@ -868,7 +865,6 @@ namespace Greenshot {
//
// groupBoxColors
//
this.groupBoxColors.AutoSize = true;
this.groupBoxColors.Controls.Add(this.checkboxPrintInverted);
this.groupBoxColors.Controls.Add(this.radioBtnColorPrint);
this.groupBoxColors.Controls.Add(this.radioBtnGrayScale);
@ -882,7 +878,6 @@ namespace Greenshot {
//
// checkboxPrintInverted
//
this.checkboxPrintInverted.AutoSize = true;
this.checkboxPrintInverted.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxPrintInverted.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxPrintInverted.LanguageKey = "printoptions_inverted";
@ -896,7 +891,6 @@ namespace Greenshot {
//
// radioBtnColorPrint
//
this.radioBtnColorPrint.AutoSize = true;
this.radioBtnColorPrint.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.radioBtnColorPrint.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.radioBtnColorPrint.LanguageKey = "printoptions_printcolor";
@ -910,7 +904,6 @@ namespace Greenshot {
//
// radioBtnGrayScale
//
this.radioBtnGrayScale.AutoSize = true;
this.radioBtnGrayScale.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.radioBtnGrayScale.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.radioBtnGrayScale.LanguageKey = "printoptions_printgrayscale";
@ -925,7 +918,6 @@ namespace Greenshot {
//
// radioBtnMonochrome
//
this.radioBtnMonochrome.AutoSize = true;
this.radioBtnMonochrome.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.radioBtnMonochrome.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.radioBtnMonochrome.LanguageKey = "printoptions_printmonochrome";
@ -939,7 +931,6 @@ namespace Greenshot {
//
// groupBoxPrintLayout
//
this.groupBoxPrintLayout.AutoSize = true;
this.groupBoxPrintLayout.Controls.Add(this.checkboxDateTime);
this.groupBoxPrintLayout.Controls.Add(this.checkboxAllowShrink);
this.groupBoxPrintLayout.Controls.Add(this.checkboxAllowEnlarge);
@ -954,7 +945,6 @@ namespace Greenshot {
//
// checkboxDateTime
//
this.checkboxDateTime.AutoSize = true;
this.checkboxDateTime.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxDateTime.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxDateTime.LanguageKey = "printoptions_timestamp";
@ -968,7 +958,6 @@ namespace Greenshot {
//
// checkboxAllowShrink
//
this.checkboxAllowShrink.AutoSize = true;
this.checkboxAllowShrink.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxAllowShrink.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxAllowShrink.LanguageKey = "printoptions_allowshrink";
@ -982,7 +971,6 @@ namespace Greenshot {
//
// checkboxAllowEnlarge
//
this.checkboxAllowEnlarge.AutoSize = true;
this.checkboxAllowEnlarge.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxAllowEnlarge.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxAllowEnlarge.LanguageKey = "printoptions_allowenlarge";
@ -996,7 +984,6 @@ namespace Greenshot {
//
// checkboxAllowRotate
//
this.checkboxAllowRotate.AutoSize = true;
this.checkboxAllowRotate.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxAllowRotate.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxAllowRotate.LanguageKey = "printoptions_allowrotate";
@ -1010,7 +997,6 @@ namespace Greenshot {
//
// checkboxAllowCenter
//
this.checkboxAllowCenter.AutoSize = true;
this.checkboxAllowCenter.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxAllowCenter.ImageAlign = System.Drawing.ContentAlignment.TopLeft;
this.checkboxAllowCenter.LanguageKey = "printoptions_allowcenter";
@ -1075,7 +1061,6 @@ namespace Greenshot {
// button_pluginconfigure
//
this.button_pluginconfigure.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.button_pluginconfigure.AutoSize = true;
this.button_pluginconfigure.Enabled = false;
this.button_pluginconfigure.LanguageKey = "settings_configureplugin";
this.button_pluginconfigure.Location = new System.Drawing.Point(6, 285);
@ -1164,7 +1149,6 @@ namespace Greenshot {
//
// label_counter
//
this.label_counter.AutoSize = true;
this.label_counter.LanguageKey = "expertsettings_counter";
this.label_counter.Location = new System.Drawing.Point(7, 285);
this.label_counter.Name = "label_counter";
@ -1181,7 +1165,6 @@ namespace Greenshot {
//
// label_footerpattern
//
this.label_footerpattern.AutoSize = true;
this.label_footerpattern.LanguageKey = "expertsettings_footerpattern";
this.label_footerpattern.Location = new System.Drawing.Point(7, 259);
this.label_footerpattern.Name = "label_footerpattern";
@ -1229,7 +1212,6 @@ namespace Greenshot {
//
// label_clipboardformats
//
this.label_clipboardformats.AutoSize = true;
this.label_clipboardformats.LanguageKey = "expertsettings_clipboardformats";
this.label_clipboardformats.Location = new System.Drawing.Point(7, 39);
this.label_clipboardformats.Name = "label_clipboardformats";
@ -1273,7 +1255,6 @@ namespace Greenshot {
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.AutoSize = true;
this.ClientSize = new System.Drawing.Size(451, 431);
this.Controls.Add(this.tabcontrol);
this.Controls.Add(this.settings_confirm);

View file

@ -123,7 +123,6 @@ namespace Greenshot.Forms {
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(153, 63);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(12, 13);
@ -184,7 +183,6 @@ namespace Greenshot.Forms {
//
// labelDarkness
//
this.labelDarkness.AutoSize = true;
this.labelDarkness.LanguageKey = "editor_dropshadow_darkness";
this.labelDarkness.Location = new System.Drawing.Point(12, 97);
this.labelDarkness.Name = "labelDarkness";
@ -194,7 +192,6 @@ namespace Greenshot.Forms {
//
// labelOffset
//
this.labelOffset.AutoSize = true;
this.labelOffset.LanguageKey = "editor_dropshadow_offset";
this.labelOffset.Location = new System.Drawing.Point(12, 63);
this.labelOffset.Name = "labelOffset";
@ -203,7 +200,6 @@ namespace Greenshot.Forms {
//
// labelThickness
//
this.labelThickness.AutoSize = true;
this.labelThickness.LanguageKey = "editor_dropshadow_thickness";
this.labelThickness.Location = new System.Drawing.Point(12, 37);
this.labelThickness.Name = "labelThickness";
@ -234,7 +230,6 @@ namespace Greenshot.Forms {
//
// label_toothsize
//
this.label_toothsize.AutoSize = true;
this.label_toothsize.LanguageKey = "editor_tornedge_toothsize";
this.label_toothsize.Location = new System.Drawing.Point(12, 140);
this.label_toothsize.Name = "label_toothsize";
@ -243,7 +238,6 @@ namespace Greenshot.Forms {
//
// label_horizontaltoothrange
//
this.label_horizontaltoothrange.AutoSize = true;
this.label_horizontaltoothrange.LanguageKey = "editor_tornedge_horizontaltoothrange";
this.label_horizontaltoothrange.Location = new System.Drawing.Point(12, 166);
this.label_horizontaltoothrange.Name = "label_horizontaltoothrange";
@ -273,7 +267,6 @@ namespace Greenshot.Forms {
//
// labelVerticaltoothrange
//
this.labelVerticaltoothrange.AutoSize = true;
this.labelVerticaltoothrange.LanguageKey = "editor_tornedge_verticaltoothrange";
this.labelVerticaltoothrange.Location = new System.Drawing.Point(12, 192);
this.labelVerticaltoothrange.Name = "labelVerticaltoothrange";
@ -351,7 +344,6 @@ namespace Greenshot.Forms {
//
// shadowCheckbox
//
this.shadowCheckbox.AutoSize = true;
this.shadowCheckbox.LanguageKey = "editor_tornedge_shadow";
this.shadowCheckbox.Location = new System.Drawing.Point(12, 12);
this.shadowCheckbox.Name = "shadowCheckbox";
@ -362,7 +354,6 @@ namespace Greenshot.Forms {
//
// all
//
this.all.AutoSize = true;
this.all.LanguageKey = "editor_tornedge_all";
this.all.Location = new System.Drawing.Point(251, 12);
this.all.Name = "all";
@ -374,8 +365,8 @@ namespace Greenshot.Forms {
// TornEdgeSettingsForm
//
this.AcceptButton = this.buttonOK;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.CancelButton = this.buttonCancel;
this.ClientSize = new System.Drawing.Size(502, 223);
this.ControlBox = false;

View file

@ -1,20 +1,20 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
*
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 1 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

View file

@ -846,7 +846,7 @@ namespace Greenshot.Helpers {
// Restore the window making sure it's visible!
windowToCapture.Restore();
} else {
windowToCapture.ToForeground(false);
windowToCapture.ToForeground();
}
tmpCapture = windowToCapture.CaptureGdiWindow(captureForWindow);
if (tmpCapture != null) {
@ -941,7 +941,7 @@ namespace Greenshot.Helpers {
}
private void SetDpi() {
// Workaround for proble with DPI retrieval, the FromHwnd activates the window...
// Workaround for problem with DPI retrieval, the FromHwnd activates the window...
WindowDetails previouslyActiveWindow = WindowDetails.GetActiveWindow();
// Workaround for changed DPI settings in Windows 7
var mainForm = SimpleServiceProvider.Current.GetInstance<MainForm>();
@ -950,7 +950,7 @@ namespace Greenshot.Helpers {
_capture.CaptureDetails.DpiY = graphics.DpiY;
}
// Set previouslyActiveWindow as foreground window
previouslyActiveWindow?.ToForeground(false);
previouslyActiveWindow?.ToForeground();
if (_capture.CaptureDetails != null) {
((Bitmap) _capture.Image)?.SetResolution(_capture.CaptureDetails.DpiX, _capture.CaptureDetails.DpiY);
}

View file

@ -109,7 +109,6 @@ namespace GreenshotBoxPlugin {
// checkboxAfterUploadLinkToClipBoard
//
this.checkboxAfterUploadLinkToClipBoard.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.checkboxAfterUploadLinkToClipBoard.AutoSize = true;
this.checkboxAfterUploadLinkToClipBoard.LanguageKey = "box.label_AfterUploadLinkToClipBoard";
this.checkboxAfterUploadLinkToClipBoard.Location = new System.Drawing.Point(208, 45);
this.checkboxAfterUploadLinkToClipBoard.Name = "checkboxAfterUploadLinkToClipBoard";

View file

@ -106,7 +106,6 @@ namespace GreenshotDropboxPlugin {
//
// checkboxAfterUploadLinkToClipBoard
//
this.checkboxAfterUploadLinkToClipBoard.AutoSize = true;
this.checkboxAfterUploadLinkToClipBoard.LanguageKey = "dropbox.label_AfterUploadLinkToClipBoard";
this.checkboxAfterUploadLinkToClipBoard.Location = new System.Drawing.Point(116, 37);
this.checkboxAfterUploadLinkToClipBoard.Name = "checkboxAfterUploadLinkToClipBoard";

View file

@ -130,8 +130,8 @@ namespace GreenshotExternalCommandPlugin {
// SettingsForm
//
this.AcceptButton = this.buttonOk;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.CancelButton = this.buttonCancel;
this.ClientSize = new System.Drawing.Size(365, 208);
this.Controls.Add(this.button_edit);

View file

@ -168,8 +168,8 @@ namespace GreenshotExternalCommandPlugin {
// SettingsFormDetail
//
this.AcceptButton = this.buttonOk;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
this.CancelButton = this.buttonCancel;
this.ClientSize = new System.Drawing.Size(360, 172);

View file

@ -105,7 +105,6 @@ namespace GreenshotFlickrPlugin {
//
// checkBoxPublic
//
this.checkBoxPublic.AutoSize = true;
this.checkBoxPublic.LanguageKey = "flickr.public";
this.checkBoxPublic.Location = new System.Drawing.Point(174, 88);
this.checkBoxPublic.Name = "checkBoxPublic";
@ -117,7 +116,6 @@ namespace GreenshotFlickrPlugin {
//
// checkBoxFamily
//
this.checkBoxFamily.AutoSize = true;
this.checkBoxFamily.LanguageKey = "flickr.family";
this.checkBoxFamily.Location = new System.Drawing.Point(265, 88);
this.checkBoxFamily.Name = "checkBoxFamily";
@ -129,7 +127,6 @@ namespace GreenshotFlickrPlugin {
//
// checkBoxFriend
//
this.checkBoxFriend.AutoSize = true;
this.checkBoxFriend.LanguageKey = "flickr.friend";
this.checkBoxFriend.Location = new System.Drawing.Point(350, 88);
this.checkBoxFriend.Name = "checkBoxFriend";
@ -170,7 +167,6 @@ namespace GreenshotFlickrPlugin {
//
// checkboxAfterUploadLinkToClipBoard
//
this.checkboxAfterUploadLinkToClipBoard.AutoSize = true;
this.checkboxAfterUploadLinkToClipBoard.LanguageKey = "flickr.label_AfterUploadLinkToClipBoard";
this.checkboxAfterUploadLinkToClipBoard.Location = new System.Drawing.Point(173, 116);
this.checkboxAfterUploadLinkToClipBoard.Name = "checkboxAfterUploadLinkToClipBoard";
@ -182,7 +178,6 @@ namespace GreenshotFlickrPlugin {
//
// checkBox_hiddenfromsearch
//
this.checkBox_hiddenfromsearch.AutoSize = true;
this.checkBox_hiddenfromsearch.LanguageKey = "flickr.label_HiddenFromSearch";
this.checkBox_hiddenfromsearch.Location = new System.Drawing.Point(174, 60);
this.checkBox_hiddenfromsearch.Name = "checkBox_hiddenfromsearch";

View file

@ -87,7 +87,6 @@ namespace GreenshotImgurPlugin
// deleteButton
//
this.deleteButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.deleteButton.AutoSize = true;
this.deleteButton.Location = new System.Drawing.Point(109, 272);
this.deleteButton.Name = "deleteButton";
this.deleteButton.Size = new System.Drawing.Size(75, 23);
@ -99,7 +98,6 @@ namespace GreenshotImgurPlugin
// openButton
//
this.openButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.openButton.AutoSize = true;
this.openButton.Location = new System.Drawing.Point(109, 305);
this.openButton.Name = "openButton";
this.openButton.Size = new System.Drawing.Size(75, 23);
@ -122,7 +120,6 @@ namespace GreenshotImgurPlugin
// clipboardButton
//
this.clipboardButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.clipboardButton.AutoSize = true;
this.clipboardButton.Location = new System.Drawing.Point(109, 338);
this.clipboardButton.Name = "clipboardButton";
this.clipboardButton.Size = new System.Drawing.Size(129, 23);
@ -144,8 +141,8 @@ namespace GreenshotImgurPlugin
//
// ImgurHistory
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(534, 372);
this.Controls.Add(this.clearHistoryButton);
this.Controls.Add(this.clipboardButton);

View file

@ -109,7 +109,6 @@ namespace GreenshotImgurPlugin {
//
// checkbox_anonymous_access
//
this.checkbox_anonymous_access.AutoSize = true;
this.checkbox_anonymous_access.LanguageKey = "imgur.anonymous_access";
this.checkbox_anonymous_access.Location = new System.Drawing.Point(15, 38);
this.checkbox_anonymous_access.Name = "checkbox_anonymous_access";
@ -121,7 +120,6 @@ namespace GreenshotImgurPlugin {
//
// checkbox_usepagelink
//
this.checkbox_usepagelink.AutoSize = true;
this.checkbox_usepagelink.LanguageKey = "imgur.use_page_link";
this.checkbox_usepagelink.Location = new System.Drawing.Point(15, 57);
this.checkbox_usepagelink.Name = "checkbox_usepagelink";

View file

@ -1,20 +1,20 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
*
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 1 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@ -171,12 +171,11 @@ namespace GreenshotImgurPlugin {
{
AuthUrlPattern = AuthUrlPattern,
TokenUrl = TokenUrl,
RedirectUrl = "https://imgur.com",
RedirectUrl = "https://getgreenshot.org/oauth/imgur",
CloudServiceName = "Imgur",
ClientId = ImgurCredentials.CONSUMER_KEY,
ClientSecret = ImgurCredentials.CONSUMER_SECRET,
AuthorizeMode = OAuth2AuthorizeMode.EmbeddedBrowser,
BrowserSize = new Size(680, 880),
AuthorizeMode = OAuth2AuthorizeMode.OutOfBoundAuto,
RefreshToken = Config.RefreshToken,
AccessToken = Config.AccessToken,
AccessTokenExpires = Config.AccessTokenExpires
@ -280,7 +279,7 @@ namespace GreenshotImgurPlugin {
/// <param name="imgurInfo"></param>
public static void DeleteImgurImage(ImgurInfo imgurInfo) {
Log.InfoFormat("Deleting Imgur image for {0}", imgurInfo.DeleteHash);
try {
string url = Config.ImgurApi3Url + "/image/" + imgurInfo.DeleteHash + ".xml";
HttpWebRequest webRequest = NetworkHelper.CreateWebRequest(url, HTTPMethod.DELETE);

View file

@ -71,7 +71,6 @@ namespace GreenshotJiraPlugin.Forms {
//
// label_jirafilter
//
this.label_jirafilter.AutoSize = true;
this.label_jirafilter.Location = new System.Drawing.Point(14, 14);
this.label_jirafilter.Name = "label_jirafilter";
this.label_jirafilter.Size = new System.Drawing.Size(52, 13);
@ -80,7 +79,6 @@ namespace GreenshotJiraPlugin.Forms {
//
// label_jira
//
this.label_jira.AutoSize = true;
this.label_jira.Location = new System.Drawing.Point(14, 41);
this.label_jira.Name = "label_jira";
this.label_jira.Size = new System.Drawing.Size(30, 13);
@ -127,7 +125,6 @@ namespace GreenshotJiraPlugin.Forms {
// label_filename
//
this.label_filename.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label_filename.AutoSize = true;
this.label_filename.Location = new System.Drawing.Point(14, 222);
this.label_filename.Name = "label_filename";
this.label_filename.Size = new System.Drawing.Size(49, 13);
@ -137,7 +134,6 @@ namespace GreenshotJiraPlugin.Forms {
// label_comment
//
this.label_comment.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label_comment.AutoSize = true;
this.label_comment.Location = new System.Drawing.Point(14, 248);
this.label_comment.Name = "label_comment";
this.label_comment.Size = new System.Drawing.Size(51, 13);
@ -167,7 +163,6 @@ namespace GreenshotJiraPlugin.Forms {
// label1
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(14, 274);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(23, 13);

View file

@ -96,7 +96,6 @@ namespace GreenshotPhotobucketPlugin {
//
// checkbox_usepagelink
//
this.checkbox_usepagelink.AutoSize = true;
this.checkbox_usepagelink.LanguageKey = "photobucket.use_page_link";
this.checkbox_usepagelink.Location = new System.Drawing.Point(15, 43);
this.checkbox_usepagelink.Name = "checkbox_usepagelink";

View file

@ -108,7 +108,6 @@ namespace GreenshotPicasaPlugin {
// checkboxAfterUploadLinkToClipBoard
//
this.checkboxAfterUploadLinkToClipBoard.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.checkboxAfterUploadLinkToClipBoard.AutoSize = true;
this.checkboxAfterUploadLinkToClipBoard.LanguageKey = "picasa.label_AfterUploadLinkToClipBoard";
this.checkboxAfterUploadLinkToClipBoard.Location = new System.Drawing.Point(197, 50);
this.checkboxAfterUploadLinkToClipBoard.Name = "checkboxAfterUploadLinkToClipBoard";

View file

@ -55,7 +55,6 @@ namespace GreenshotPlugin.Controls
//
// label_pleasewait
//
this.label_pleasewait.AutoSize = true;
this.label_pleasewait.Dock = System.Windows.Forms.DockStyle.Fill;
this.label_pleasewait.Location = new System.Drawing.Point(0, 0);
this.label_pleasewait.Name = "label_pleasewait";
@ -73,9 +72,8 @@ namespace GreenshotPlugin.Controls
//
// BackgroundForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoSize = true;
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(169, 52);
this.ControlBox = true;
this.Controls.Add(this.label_pleasewait);

View file

@ -1,20 +1,20 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
*
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 1 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@ -101,10 +101,10 @@ namespace GreenshotPlugin.Controls {
_designTimeToolStripItems = new Dictionary<string, ToolStripItem>();
try {
ITypeResolutionService typeResService = GetService(typeof(ITypeResolutionService)) as ITypeResolutionService;
// Add a hard-path if you are using SharpDevelop
// Language.AddLanguageFilePath(@"C:\Greenshot\Greenshot\Languages");
// this "type"
Assembly currentAssembly = GetType().Assembly;
if (typeResService != null)
@ -209,11 +209,11 @@ namespace GreenshotPlugin.Controls {
}
private void ClearChangeNotifications() {
// The m_changeService value is null when not in design mode,
// as the IComponentChangeService is only available at design time.
// The m_changeService value is null when not in design mode,
// as the IComponentChangeService is only available at design time.
m_changeService = (IComponentChangeService)GetService(typeof(IComponentChangeService));
// Clear our the component change events to prepare for re-siting.
// Clear our the component change events to prepare for re-siting.
if (m_changeService != null) {
m_changeService.ComponentChanged -= OnComponentChanged;
m_changeService.ComponentAdded -= OnComponentAdded;
@ -335,7 +335,7 @@ namespace GreenshotPlugin.Controls {
}
}
}
/// <summary>
/// Helper method to cache the fieldinfo values, so we don't need to reflect all the time!
/// </summary>
@ -379,8 +379,8 @@ namespace GreenshotPlugin.Controls {
ApplyLanguage(applyToControl);
}
}
if (DesignMode) {
if (DesignMode) {
foreach (Control designControl in _designTimeControls.Values) {
ApplyLanguage(designControl);
}
@ -514,7 +514,7 @@ namespace GreenshotPlugin.Controls {
iniValue.Value = comboxBox.GetSelectedEnum();
iniDirty = true;
}
}
}
}

View file

@ -70,8 +70,8 @@ namespace GreenshotPlugin.Controls {
//
// OAuthLoginForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(595, 315);
this.Controls.Add(this._browser);
this.Controls.Add(this._addressTextBox);

View file

@ -50,7 +50,6 @@ namespace GreenshotPlugin.Controls {
//
// label_pleasewait
//
this.label_pleasewait.AutoSize = true;
this.label_pleasewait.Dock = System.Windows.Forms.DockStyle.Fill;
this.label_pleasewait.Location = new System.Drawing.Point(0, 0);
this.label_pleasewait.Name = "label_pleasewait";
@ -77,9 +76,8 @@ namespace GreenshotPlugin.Controls {
//
// PleaseWaitForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoSize = true;
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(169, 76);
this.Controls.Add(this.cancelButton);

View file

@ -108,7 +108,6 @@ namespace GreenshotPlugin.Controls {
//
// checkBox_reduceColors
//
this.checkBox_reduceColors.AutoSize = true;
this.checkBox_reduceColors.Location = new System.Drawing.Point(12, 11);
this.checkBox_reduceColors.Name = "checkBox_reduceColors";
this.checkBox_reduceColors.Size = new System.Drawing.Size(95, 17);
@ -116,7 +115,7 @@ namespace GreenshotPlugin.Controls {
this.checkBox_reduceColors.Text = "settings_reducecolors";
this.checkBox_reduceColors.UseVisualStyleBackColor = true;
//
// QualityDialog
// QualityDialog
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;

View file

@ -155,10 +155,14 @@ namespace GreenshotPlugin.Core {
TopLevel = true
};
menu.Opened += (sender, args) =>
{
var scaledIconSize = DpiHelper.ScaleWithDpi(CoreConfig.IconSize, DpiHelper.GetDpi(menu.Handle));
menu.Opening += (sender, args) =>
{
// find the DPI settings for the screen where this is going to land
var screenDpi = DpiHelper.GetDpi(menu.Location);
var scaledIconSize = DpiHelper.ScaleWithDpi(CoreConfig.IconSize, screenDpi);
menu.SuspendLayout();
menu.ImageScalingSize = scaledIconSize;
menu.ResumeLayout();
};
menu.Closing += delegate(object source, ToolStripDropDownClosingEventArgs eventArgs) {
@ -191,7 +195,10 @@ namespace GreenshotPlugin.Core {
menu.MouseEnter += delegate
{
// in case the menu has been unfocused, focus again so that dropdown menus will still open on mouseenter
if(!menu.ContainsFocus) menu.Focus();
if (!menu.ContainsFocus)
{
menu.Focus();
}
};
foreach (IDestination destination in destinations) {
// Fix foreach loop variable for the delegate

View file

@ -453,6 +453,24 @@ namespace GreenshotPlugin.Core
}
}
/// <summary>
/// Return the DPI for the screen which the location is located on
/// </summary>
/// <param name="location">POINT</param>
/// <returns>uint</returns>
public static uint GetDpi(POINT location)
{
RECT rect = new RECT(location.X, location.Y, 1,1);
IntPtr hMonitor = User32.MonitorFromRect(ref rect, User32.MONITOR_DEFAULTTONEAREST);
var result = GetDpiForMonitor(hMonitor, MonitorDpiType.EffectiveDpi, out var dpiX, out var dpiY);
if (result.Succeeded())
{
return dpiX;
}
return DefaultScreenDpi;
}
/// <summary>
/// Retrieve the DPI value for the supplied window handle
/// </summary>
@ -476,7 +494,8 @@ namespace GreenshotPlugin.Core
{
var hMonitor = User32.MonitorFromWindow(hWnd, MonitorFrom.DefaultToNearest);
// ReSharper disable once UnusedVariable
if (GetDpiForMonitor(hMonitor, MonitorDpiType.EffectiveDpi, out var dpiX, out var dpiY))
var result = GetDpiForMonitor(hMonitor, MonitorDpiType.EffectiveDpi, out var dpiX, out var dpiY);
if (result.Succeeded())
{
return dpiX;
}
@ -544,9 +563,8 @@ namespace GreenshotPlugin.Core
/// <param name="dpiX">out int for the horizontal dpi</param>
/// <param name="dpiY">out int for the vertical dpi</param>
/// <returns>true if all okay</returns>
[DllImport("shcore")]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool GetDpiForMonitor(IntPtr hMonitor, MonitorDpiType dpiType, out uint dpiX, out uint dpiY);
[DllImport("shcore.dll", SetLastError = true)]
private static extern HResult GetDpiForMonitor(IntPtr hMonitor, MonitorDpiType dpiType, out uint dpiX, out uint dpiY);
/// <summary>
/// See <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/mt748621(v=vs.85).aspx">EnableNonClientDpiScaling function</a>

View file

@ -1,20 +1,20 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
*
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 1 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@ -32,6 +32,8 @@ using System.Net.Sockets;
using System.Security.Cryptography;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using GreenshotPlugin.Hooking;
namespace GreenshotPlugin.Core {
/// <summary>
@ -41,16 +43,17 @@ namespace GreenshotPlugin.Core {
HMACSHA1,
PLAINTEXT,
}
/// <summary>
/// Specify the autorize mode that is used to get the token from the cloud service.
/// Specify the authorize mode that is used to get the token from the cloud service.
/// </summary>
public enum OAuth2AuthorizeMode {
Unknown, // Will give an exception, caller needs to specify another value
LocalServer, // Will specify a redirect URL to http://localhost:port/authorize, while having a HttpListener
MonitorTitle, // Not implemented yet: Will monitor for title changes
Pin, // Not implemented yet: Will ask the user to enter the shown PIN
EmbeddedBrowser // Will open into an embedded _browser (OAuthLoginForm), and catch the redirect
Unknown, // Will give an exception, caller needs to specify another value
LocalServer, // Will specify a redirect URL to http://localhost:port/authorize, while having a HttpListener
MonitorTitle, // Not implemented yet: Will monitor for title changes
Pin, // Not implemented yet: Will ask the user to enter the shown PIN
EmbeddedBrowser, // Will open into an embedded _browser (OAuthLoginForm), and catch the redirect
OutOfBoundAuto
}
/// <summary>
@ -211,7 +214,7 @@ namespace GreenshotPlugin.Core {
//
// List of know and used oauth parameters' names
//
//
protected const string OAUTH_CONSUMER_KEY_KEY = "oauth_consumer_key";
protected const string OAUTH_CALLBACK_KEY = "oauth_callback";
protected const string OAUTH_VERSION_KEY = "oauth_version";
@ -395,7 +398,7 @@ namespace GreenshotPlugin.Core {
}
/// <summary>
/// Generate the timestamp for the signature
/// Generate the timestamp for the signature
/// </summary>
/// <returns></returns>
public static string GenerateTimeStamp() {
@ -472,7 +475,7 @@ namespace GreenshotPlugin.Core {
/// <summary>
/// Get the access token
/// </summary>
/// <returns>The access token.</returns>
/// <returns>The access token.</returns>
private string GetAccessToken() {
if (string.IsNullOrEmpty(Token) || (CheckVerifier && string.IsNullOrEmpty(Verifier))) {
Exception e = new Exception("The request token and verifier were not set");
@ -1121,12 +1124,43 @@ Greenshot received information from CloudServiceName. You can close this browser
{
OAuth2AuthorizeMode.LocalServer => AuthenticateViaLocalServer(settings),
OAuth2AuthorizeMode.EmbeddedBrowser => AuthenticateViaEmbeddedBrowser(settings),
_ => throw new NotImplementedException($"Authorize mode '{settings.AuthorizeMode}' is not 'yet' implemented."),
OAuth2AuthorizeMode.OutOfBoundAuto => AuthenticateViaDefaultBrowser(settings),
_ => throw new NotImplementedException($"Authorize mode '{settings.AuthorizeMode}' is not 'yet' implemented."),
};
return completed;
}
/// <summary>
/// <summary>
/// Authenticate via the default browser
/// If this works, return the code
/// </summary>
/// <param name="settings">OAuth2Settings with the Auth / Token url etc</param>
/// <returns>true if completed, false if canceled</returns>
private static bool AuthenticateViaDefaultBrowser(OAuth2Settings settings)
{
var monitor = new WindowsTitleMonitor();
string[] code = new string[1];
monitor.TitleChangeEvent += args =>
{
if (args.Title.Contains(settings.State))
{
code[0] = args.Title;
settings.Code = args.Title;
}
};
using (var process = Process.Start(settings.FormattedAuthUrl))
{
while (string.IsNullOrEmpty(code[0]))
{
Application.DoEvents();
}
};
return true;
}
/// <summary>
/// Authenticate via an embedded browser
/// If this works, return the code
/// </summary>
@ -1192,7 +1226,7 @@ Greenshot received information from CloudServiceName. You can close this browser
}
/// <summary>
/// Check and authenticate or refresh tokens
/// Check and authenticate or refresh tokens
/// </summary>
/// <param name="settings">OAuth2Settings</param>
public static void CheckAndAuthenticateOrRefresh(OAuth2Settings settings) {

View file

@ -1137,46 +1137,50 @@ namespace GreenshotPlugin.Core
/// <summary>
/// Set the window as foreground window
/// </summary>
/// <param name="handle">hWnd of the window to bring to the foreground</param>
/// <param name="workaround">bool with true to use a trick to really bring the window to the foreground</param>
public static void ToForeground(IntPtr handle, bool workaround = true)
/// <param name="hWnd">hWnd of the window to bring to the foreground</param>
public static void ToForeground(IntPtr hWnd)
{
var window = new WindowDetails(handle);
var foregroundWindow = User32.GetForegroundWindow();
if (hWnd == foregroundWindow)
{
return;
}
var window = new WindowDetails(hWnd);
// Nothing we can do if it's not visible!
if (!window.Visible)
{
return;
}
var threadId1 = User32.GetWindowThreadProcessId(foregroundWindow, IntPtr.Zero);
var threadId2 = User32.GetWindowThreadProcessId(hWnd, IntPtr.Zero);
// Show window in foreground.
if (threadId1 != threadId2)
{
User32.AttachThreadInput(threadId1, threadId2, 1);
User32.SetForegroundWindow(hWnd);
User32.AttachThreadInput(threadId1, threadId2, 0);
}
else
{
User32.SetForegroundWindow(hWnd);
}
User32.BringWindowToTop(hWnd);
if (window.Iconic)
{
window.Iconic = false;
while (window.Iconic)
{
Application.DoEvents();
}
}
// See https://msdn.microsoft.com/en-us/library/windows/desktop/ms633539(v=vs.85).aspx
if (workaround)
{
const byte alt = 0xA4;
const int extendedKey = 0x1;
const int keyup = 0x2;
// Simulate an "ALT" key press.
User32.keybd_event(alt, 0x45, extendedKey | 0, 0);
// Simulate an "ALT" key release.
User32.keybd_event(alt, 0x45, extendedKey | keyup, 0);
}
// Show window in forground.
User32.BringWindowToTop(handle);
User32.SetForegroundWindow(handle);
}
/// <summary>
/// Set the window as foreground window
/// </summary>
/// <param name="workaround">true to use a workaround, otherwise the window might only flash</param>
public void ToForeground(bool workaround = true) {
ToForeground(Handle, workaround);
public void ToForeground() {
ToForeground(Handle);
}
/// <summary>

View file

@ -1,20 +1,20 @@
/*
* Greenshot - a free and open source screenshot tool
* Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom
*
*
* For more information see: http://getgreenshot.org/
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 1 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@ -104,8 +104,8 @@ namespace GreenshotPlugin.Interfaces {
Keys EditorShortcutKeys {
get;
}
/// <summary>
/// <summary>
/// Gets the dynamic destinations
/// </summary>
IEnumerable<IDestination> DynamicDestinations();

View file

@ -52,9 +52,6 @@ namespace GreenshotPlugin.UnmanagedHelpers {
public const int MONITOR_DEFAULTTONEAREST = 2;
public const int CURSOR_SHOWING = 0x00000001;
[DllImport("user32", SetLastError = true)]
public static extern bool keybd_event(byte bVk, byte bScan, uint dwFlags, int dwExtraInfo);
/// <summary>
/// Determines whether the specified window handle identifies an existing window.
/// </summary>
@ -72,6 +69,11 @@ namespace GreenshotPlugin.UnmanagedHelpers {
public static extern bool IsWindowVisible(IntPtr hWnd);
[DllImport("user32", SetLastError = true)]
public static extern int GetWindowThreadProcessId(IntPtr hWnd, out int processId);
[DllImport("user32", SetLastError = true)]
public static extern int GetWindowThreadProcessId(IntPtr hWnd, IntPtr processId);
[DllImport("user32")]
public static extern IntPtr AttachThreadInput(int idAttach, int idAttachTo, int fAttach);
[DllImport("user32", SetLastError = true)]
public static extern IntPtr GetParent(IntPtr hWnd);
[DllImport("user32", SetLastError = true)]