diff --git a/shadowsocks-csharp/View/MenuViewController.cs b/shadowsocks-csharp/View/MenuViewController.cs
index 4a514ac0..d0eb8d92 100755
--- a/shadowsocks-csharp/View/MenuViewController.cs
+++ b/shadowsocks-csharp/View/MenuViewController.cs
@@ -387,7 +387,26 @@ namespace Shadowsocks.View
var success = controller.AddServerBySSURL(result.Text);
if (success)
{
- ShowConfigForm();
+ float minX = Int32.MaxValue, minY = Int32.MaxValue, maxX = 0, maxY = 0;
+ foreach (ResultPoint point in result.ResultPoints)
+ {
+ minX = Math.Min(minX, point.X);
+ minY = Math.Min(minY, point.Y);
+ maxX = Math.Max(maxX, point.X);
+ maxY = Math.Max(maxY, point.Y);
+ }
+ // make it 20% larger
+ float margin = (maxX - minX) * 0.20f;
+ minX -= margin;
+ maxX += margin;
+ minY -= margin;
+ maxY += margin;
+
+ QRCodeSplashForm splash = new QRCodeSplashForm();
+ splash.FormClosed += splash_FormClosed;
+ splash.Location = new Point((int)minX, (int)minY);
+ splash.Size = new Size((int)maxX - (int)minX, (int)maxY - (int)minY);
+ splash.Show();
return;
}
}
@@ -395,6 +414,11 @@ namespace Shadowsocks.View
}
}
+ void splash_FormClosed(object sender, FormClosedEventArgs e)
+ {
+ ShowConfigForm();
+ }
+
private void AutoStartupItem_Click(object sender, EventArgs e) {
AutoStartupItem.Checked = !AutoStartupItem.Checked;
if (!AutoStartup.Set(AutoStartupItem.Checked)) {
diff --git a/shadowsocks-csharp/View/QRCodeForm.Designer.cs b/shadowsocks-csharp/View/QRCodeForm.Designer.cs
index 89a07907..d334c761 100755
--- a/shadowsocks-csharp/View/QRCodeForm.Designer.cs
+++ b/shadowsocks-csharp/View/QRCodeForm.Designer.cs
@@ -34,10 +34,10 @@
//
// pictureBox1
//
- this.pictureBox1.Location = new System.Drawing.Point(9, 9);
+ this.pictureBox1.Location = new System.Drawing.Point(10, 10);
this.pictureBox1.Margin = new System.Windows.Forms.Padding(0);
this.pictureBox1.Name = "pictureBox1";
- this.pictureBox1.Size = new System.Drawing.Size(210, 210);
+ this.pictureBox1.Size = new System.Drawing.Size(240, 240);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pictureBox1.TabIndex = 1;
this.pictureBox1.TabStop = false;
@@ -55,7 +55,7 @@
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "QRCodeForm";
- this.Padding = new System.Windows.Forms.Padding(9);
+ this.Padding = new System.Windows.Forms.Padding(10);
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "QRCode";
this.Load += new System.EventHandler(this.QRCodeForm_Load);
diff --git a/shadowsocks-csharp/View/QRCodeForm.cs b/shadowsocks-csharp/View/QRCodeForm.cs
index 21ea3ab5..2741d4ff 100755
--- a/shadowsocks-csharp/View/QRCodeForm.cs
+++ b/shadowsocks-csharp/View/QRCodeForm.cs
@@ -30,7 +30,7 @@ namespace Shadowsocks.View
string qrText = ssconfig;
QRCode code = ZXing.QrCode.Internal.Encoder.encode(qrText, ErrorCorrectionLevel.M);
ByteMatrix m = code.Matrix;
- int blockSize = Math.Max(200 / m.Height, 1);
+ int blockSize = Math.Max(pictureBox1.Height / m.Height, 1);
Bitmap drawArea = new Bitmap((m.Width * blockSize), (m.Height * blockSize));
using (Graphics g = Graphics.FromImage(drawArea))
{
diff --git a/shadowsocks-csharp/shadowsocks-csharp.csproj b/shadowsocks-csharp/shadowsocks-csharp.csproj
index 1d91db51..15a53037 100755
--- a/shadowsocks-csharp/shadowsocks-csharp.csproj
+++ b/shadowsocks-csharp/shadowsocks-csharp.csproj
@@ -183,6 +183,12 @@
QRCodeForm.cs
+
+ Form
+
+
+ QRCodeSplashForm.cs
+
ConfigForm.cs
Designer
@@ -195,6 +201,9 @@
QRCodeForm.cs
+
+ QRCodeSplashForm.cs
+
Designer