mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-30 01:07:21 +13:00
Make sure QR code output is square image
This commit is contained in:
parent
36b0609dd9
commit
749d52e484
4 changed files with 18 additions and 9 deletions
14
ShareX/Forms/QRCodeForm.Designer.cs
generated
14
ShareX/Forms/QRCodeForm.Designer.cs
generated
|
@ -33,6 +33,7 @@ private void InitializeComponent()
|
|||
this.cmsQR = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.tsmiCopy = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tsmiSaveAs = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tsmiDecode = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.txtQRCode = new System.Windows.Forms.TextBox();
|
||||
this.pbQRCode = new System.Windows.Forms.PictureBox();
|
||||
this.tcMain = new System.Windows.Forms.TabControl();
|
||||
|
@ -42,7 +43,6 @@ private void InitializeComponent()
|
|||
this.txtDecodeResult = new System.Windows.Forms.TextBox();
|
||||
this.lblDecodeResult = new System.Windows.Forms.Label();
|
||||
this.btnDecodeFromScreen = new System.Windows.Forms.Button();
|
||||
this.tsmiDecode = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.cmsQR.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pbQRCode)).BeginInit();
|
||||
this.tcMain.SuspendLayout();
|
||||
|
@ -72,6 +72,12 @@ private void InitializeComponent()
|
|||
resources.ApplyResources(this.tsmiSaveAs, "tsmiSaveAs");
|
||||
this.tsmiSaveAs.Click += new System.EventHandler(this.tsmiSaveAs_Click);
|
||||
//
|
||||
// tsmiDecode
|
||||
//
|
||||
this.tsmiDecode.Name = "tsmiDecode";
|
||||
resources.ApplyResources(this.tsmiDecode, "tsmiDecode");
|
||||
this.tsmiDecode.Click += new System.EventHandler(this.tsmiDecode_Click);
|
||||
//
|
||||
// txtQRCode
|
||||
//
|
||||
resources.ApplyResources(this.txtQRCode, "txtQRCode");
|
||||
|
@ -136,12 +142,6 @@ private void InitializeComponent()
|
|||
this.btnDecodeFromScreen.UseVisualStyleBackColor = true;
|
||||
this.btnDecodeFromScreen.Click += new System.EventHandler(this.btnDecodeFromScreen_Click);
|
||||
//
|
||||
// tsmiDecode
|
||||
//
|
||||
this.tsmiDecode.Name = "tsmiDecode";
|
||||
resources.ApplyResources(this.tsmiDecode, "tsmiDecode");
|
||||
this.tsmiDecode.Click += new System.EventHandler(this.tsmiDecode_Click);
|
||||
//
|
||||
// QRCodeForm
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
|
|
|
@ -91,7 +91,8 @@ private void EncodeText(string text)
|
|||
{
|
||||
ClearQRCode();
|
||||
|
||||
pbQRCode.Image = TaskHelpers.QRCodeEncode(text, pbQRCode.Width, pbQRCode.Height);
|
||||
int size = Math.Min(pbQRCode.Width, pbQRCode.Height);
|
||||
pbQRCode.Image = TaskHelpers.QRCodeEncode(text, size);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@
|
|||
<value>Decode</value>
|
||||
</data>
|
||||
<data name="cmsQR.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>152, 92</value>
|
||||
<value>152, 70</value>
|
||||
</data>
|
||||
<data name="cmsQR.Text" xml:space="preserve">
|
||||
<value>QR</value>
|
||||
|
@ -186,6 +186,9 @@
|
|||
<data name="pbQRCode.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>460, 444</value>
|
||||
</data>
|
||||
<data name="pbQRCode.SizeMode" type="System.Windows.Forms.PictureBoxSizeMode, System.Windows.Forms">
|
||||
<value>CenterImage</value>
|
||||
</data>
|
||||
<data name="pbQRCode.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>1</value>
|
||||
</data>
|
||||
|
|
|
@ -1602,6 +1602,11 @@ public static Image QRCodeEncode(string text, int width, int height)
|
|||
return null;
|
||||
}
|
||||
|
||||
public static Image QRCodeEncode(string text, int size)
|
||||
{
|
||||
return QRCodeEncode(text, size, size);
|
||||
}
|
||||
|
||||
public static string[] QRCodeDecode(Bitmap bmp)
|
||||
{
|
||||
try
|
||||
|
|
Loading…
Reference in a new issue