[#] fix 界面样式

This commit is contained in:
huiyadanli 2023-07-12 00:35:20 +08:00
parent 568b754cfc
commit 106860a9a6
2 changed files with 66 additions and 73 deletions

View File

@ -70,20 +70,18 @@
// lblPathTag
//
this.lblPathTag.AutoSize = true;
this.lblPathTag.Location = new System.Drawing.Point(21, 94);
this.lblPathTag.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lblPathTag.Location = new System.Drawing.Point(14, 63);
this.lblPathTag.Name = "lblPathTag";
this.lblPathTag.Size = new System.Drawing.Size(98, 18);
this.lblPathTag.Size = new System.Drawing.Size(65, 12);
this.lblPathTag.TabIndex = 1;
this.lblPathTag.Text = "应用路径:";
//
// btnPatch
//
this.btnPatch.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnPatch.Location = new System.Drawing.Point(567, 162);
this.btnPatch.Margin = new System.Windows.Forms.Padding(4);
this.btnPatch.Location = new System.Drawing.Point(378, 108);
this.btnPatch.Name = "btnPatch";
this.btnPatch.Size = new System.Drawing.Size(147, 34);
this.btnPatch.Size = new System.Drawing.Size(98, 23);
this.btnPatch.TabIndex = 3;
this.btnPatch.Text = "安装补丁!";
this.btnPatch.UseVisualStyleBackColor = true;
@ -93,20 +91,18 @@
//
this.txtPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtPath.Location = new System.Drawing.Point(126, 87);
this.txtPath.Margin = new System.Windows.Forms.Padding(4);
this.txtPath.Location = new System.Drawing.Point(84, 58);
this.txtPath.Name = "txtPath";
this.txtPath.Size = new System.Drawing.Size(526, 28);
this.txtPath.Size = new System.Drawing.Size(352, 21);
this.txtPath.TabIndex = 4;
this.txtPath.TextChanged += new System.EventHandler(this.txtPath_TextChanged);
//
// btnChoosePath
//
this.btnChoosePath.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnChoosePath.Location = new System.Drawing.Point(663, 84);
this.btnChoosePath.Margin = new System.Windows.Forms.Padding(4);
this.btnChoosePath.Location = new System.Drawing.Point(442, 56);
this.btnChoosePath.Name = "btnChoosePath";
this.btnChoosePath.Size = new System.Drawing.Size(51, 34);
this.btnChoosePath.Size = new System.Drawing.Size(34, 23);
this.btnChoosePath.TabIndex = 5;
this.btnChoosePath.Text = "...";
this.btnChoosePath.UseVisualStyleBackColor = true;
@ -115,20 +111,18 @@
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(21, 208);
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label1.Location = new System.Drawing.Point(14, 139);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(188, 18);
this.label1.Size = new System.Drawing.Size(125, 12);
this.label1.TabIndex = 6;
this.label1.Text = "软件主页(免费开源)";
//
// linkLabel1
//
this.linkLabel1.AutoSize = true;
this.linkLabel1.Location = new System.Drawing.Point(207, 208);
this.linkLabel1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.linkLabel1.Location = new System.Drawing.Point(138, 139);
this.linkLabel1.Name = "linkLabel1";
this.linkLabel1.Size = new System.Drawing.Size(62, 18);
this.linkLabel1.Size = new System.Drawing.Size(41, 12);
this.linkLabel1.TabIndex = 7;
this.linkLabel1.TabStop = true;
this.linkLabel1.Text = "GitHub";
@ -137,10 +131,9 @@
// btnRestore
//
this.btnRestore.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnRestore.Location = new System.Drawing.Point(435, 162);
this.btnRestore.Margin = new System.Windows.Forms.Padding(4);
this.btnRestore.Location = new System.Drawing.Point(290, 108);
this.btnRestore.Name = "btnRestore";
this.btnRestore.Size = new System.Drawing.Size(123, 34);
this.btnRestore.Size = new System.Drawing.Size(82, 23);
this.btnRestore.TabIndex = 8;
this.btnRestore.Text = "备份还原";
this.btnRestore.UseVisualStyleBackColor = true;
@ -151,10 +144,9 @@
this.lblUpdatePachJson.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.lblUpdatePachJson.Cursor = System.Windows.Forms.Cursors.Hand;
this.lblUpdatePachJson.ForeColor = System.Drawing.Color.OrangeRed;
this.lblUpdatePachJson.Location = new System.Drawing.Point(266, 212);
this.lblUpdatePachJson.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lblUpdatePachJson.Location = new System.Drawing.Point(177, 141);
this.lblUpdatePachJson.Name = "lblUpdatePachJson";
this.lblUpdatePachJson.Size = new System.Drawing.Size(448, 18);
this.lblUpdatePachJson.Size = new System.Drawing.Size(299, 12);
this.lblUpdatePachJson.TabIndex = 9;
this.lblUpdatePachJson.Text = "[ 获取最新补丁信息中... ]";
this.lblUpdatePachJson.TextAlign = System.Drawing.ContentAlignment.TopRight;
@ -163,19 +155,17 @@
// lblVersion
//
this.lblVersion.AutoSize = true;
this.lblVersion.Location = new System.Drawing.Point(128, 170);
this.lblVersion.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lblVersion.Location = new System.Drawing.Point(85, 113);
this.lblVersion.Name = "lblVersion";
this.lblVersion.Size = new System.Drawing.Size(0, 18);
this.lblVersion.Size = new System.Drawing.Size(0, 12);
this.lblVersion.TabIndex = 10;
//
// lblVersionTag
//
this.lblVersionTag.AutoSize = true;
this.lblVersionTag.Location = new System.Drawing.Point(21, 170);
this.lblVersionTag.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lblVersionTag.Location = new System.Drawing.Point(14, 113);
this.lblVersionTag.Name = "lblVersionTag";
this.lblVersionTag.Size = new System.Drawing.Size(98, 18);
this.lblVersionTag.Size = new System.Drawing.Size(65, 12);
this.lblVersionTag.TabIndex = 9;
this.lblVersionTag.Text = "当前版本:";
//
@ -183,10 +173,9 @@
//
this.rbtWechat.AutoSize = true;
this.rbtWechat.Checked = true;
this.rbtWechat.Location = new System.Drawing.Point(126, 54);
this.rbtWechat.Margin = new System.Windows.Forms.Padding(4);
this.rbtWechat.Location = new System.Drawing.Point(84, 36);
this.rbtWechat.Name = "rbtWechat";
this.rbtWechat.Size = new System.Drawing.Size(62, 22);
this.rbtWechat.Size = new System.Drawing.Size(47, 16);
this.rbtWechat.TabIndex = 12;
this.rbtWechat.TabStop = true;
this.rbtWechat.Text = "微信";
@ -196,10 +185,9 @@
// rbtQQ
//
this.rbtQQ.AutoSize = true;
this.rbtQQ.Location = new System.Drawing.Point(213, 54);
this.rbtQQ.Margin = new System.Windows.Forms.Padding(4);
this.rbtQQ.Location = new System.Drawing.Point(142, 36);
this.rbtQQ.Name = "rbtQQ";
this.rbtQQ.Size = new System.Drawing.Size(44, 22);
this.rbtQQ.Size = new System.Drawing.Size(35, 16);
this.rbtQQ.TabIndex = 13;
this.rbtQQ.Text = "QQ";
this.rbtQQ.UseVisualStyleBackColor = true;
@ -208,10 +196,9 @@
// rbtTIM
//
this.rbtTIM.AutoSize = true;
this.rbtTIM.Location = new System.Drawing.Point(282, 54);
this.rbtTIM.Margin = new System.Windows.Forms.Padding(4);
this.rbtTIM.Location = new System.Drawing.Point(188, 36);
this.rbtTIM.Name = "rbtTIM";
this.rbtTIM.Size = new System.Drawing.Size(53, 22);
this.rbtTIM.Size = new System.Drawing.Size(41, 16);
this.rbtTIM.TabIndex = 14;
this.rbtTIM.Text = "TIM";
this.rbtTIM.UseVisualStyleBackColor = true;
@ -220,20 +207,18 @@
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(21, 57);
this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label5.Location = new System.Drawing.Point(14, 38);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(98, 18);
this.label5.Size = new System.Drawing.Size(65, 12);
this.label5.TabIndex = 16;
this.label5.Text = "选择应用:";
//
// rbtQQLite
//
this.rbtQQLite.AutoSize = true;
this.rbtQQLite.Location = new System.Drawing.Point(356, 54);
this.rbtQQLite.Margin = new System.Windows.Forms.Padding(4);
this.rbtQQLite.Location = new System.Drawing.Point(237, 36);
this.rbtQQLite.Name = "rbtQQLite";
this.rbtQQLite.Size = new System.Drawing.Size(98, 22);
this.rbtQQLite.Size = new System.Drawing.Size(71, 16);
this.rbtQQLite.TabIndex = 18;
this.rbtQQLite.Text = "QQ轻聊版";
this.rbtQQLite.UseVisualStyleBackColor = true;
@ -248,8 +233,9 @@
this.ToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Padding = new System.Windows.Forms.Padding(4, 1, 0, 1);
this.menuStrip1.RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional;
this.menuStrip1.Size = new System.Drawing.Size(735, 25);
this.menuStrip1.Size = new System.Drawing.Size(490, 24);
this.menuStrip1.TabIndex = 19;
this.menuStrip1.Text = "menuStrip1";
//
@ -260,7 +246,7 @@
this.ToolStripMenuItem,
this.ToolStripMenuItem});
this.ToolStripMenuItem.Name = "高级ToolStripMenuItem";
this.ToolStripMenuItem.Size = new System.Drawing.Size(44, 21);
this.ToolStripMenuItem.Size = new System.Drawing.Size(44, 22);
this.ToolStripMenuItem.Text = "高级";
//
// 特征码防撤回强制ToolStripMenuItem
@ -294,7 +280,7 @@
this.ToolStripMenuItem,
this.ToolStripMenuItem});
this.ToolStripMenuItem.Name = "帮助ToolStripMenuItem";
this.ToolStripMenuItem.Size = new System.Drawing.Size(44, 21);
this.ToolStripMenuItem.Size = new System.Drawing.Size(44, 22);
this.ToolStripMenuItem.Text = "帮助";
//
// 支持版本ToolStripMenuItem
@ -331,7 +317,7 @@
this.ToolStripMenuItem,
this.ToolStripMenuItem});
this.ToolStripMenuItem.Name = "关于ToolStripMenuItem";
this.ToolStripMenuItem.Size = new System.Drawing.Size(44, 21);
this.ToolStripMenuItem.Size = new System.Drawing.Size(44, 22);
this.ToolStripMenuItem.Text = "关于";
//
// 作者ToolStripMenuItem
@ -351,46 +337,46 @@
// lblCategory
//
this.lblCategory.AutoSize = true;
this.lblCategory.Location = new System.Drawing.Point(21, 134);
this.lblCategory.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lblCategory.Location = new System.Drawing.Point(14, 89);
this.lblCategory.Name = "lblCategory";
this.lblCategory.Size = new System.Drawing.Size(98, 18);
this.lblCategory.Size = new System.Drawing.Size(65, 12);
this.lblCategory.TabIndex = 20;
this.lblCategory.Text = "可选功能:";
//
// panelCategories
//
this.panelCategories.AutoSize = true;
this.panelCategories.Location = new System.Drawing.Point(124, 128);
this.panelCategories.Margin = new System.Windows.Forms.Padding(4);
this.panelCategories.Location = new System.Drawing.Point(83, 85);
this.panelCategories.Name = "panelCategories";
this.panelCategories.Size = new System.Drawing.Size(590, 27);
this.panelCategories.Size = new System.Drawing.Size(393, 18);
this.panelCategories.TabIndex = 22;
//
// panelNotice
//
this.panelNotice.BackColor = System.Drawing.SystemColors.Info;
this.panelNotice.Controls.Add(this.labelNotice);
this.panelNotice.Location = new System.Drawing.Point(24, 260);
this.panelNotice.Location = new System.Drawing.Point(16, 173);
this.panelNotice.Margin = new System.Windows.Forms.Padding(2);
this.panelNotice.Name = "panelNotice";
this.panelNotice.Size = new System.Drawing.Size(690, 41);
this.panelNotice.Size = new System.Drawing.Size(460, 0);
this.panelNotice.TabIndex = 23;
//
// labelNotice
//
this.labelNotice.BackColor = System.Drawing.Color.Transparent;
this.labelNotice.ForeColor = System.Drawing.SystemColors.MenuHighlight;
this.labelNotice.Location = new System.Drawing.Point(17, 11);
this.labelNotice.Location = new System.Drawing.Point(11, 7);
this.labelNotice.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.labelNotice.Name = "labelNotice";
this.labelNotice.Size = new System.Drawing.Size(661, 20);
this.labelNotice.Size = new System.Drawing.Size(441, 0);
this.labelNotice.TabIndex = 0;
this.labelNotice.Text = "测试测试测试测试";
//
// FormMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(735, 254);
this.ClientSize = new System.Drawing.Size(490, 169);
this.Controls.Add(this.panelNotice);
this.Controls.Add(this.panelCategories);
this.Controls.Add(this.lblCategory);
@ -412,8 +398,7 @@
this.Controls.Add(this.menuStrip1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MainMenuStrip = this.menuStrip1;
this.Margin = new System.Windows.Forms.Padding(4);
this.MinimumSize = new System.Drawing.Size(748, 196);
this.MinimumSize = new System.Drawing.Size(504, 144);
this.Name = "FormMain";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "微信/QQ/TIM防撤回补丁";

View File

@ -2,7 +2,6 @@
using RevokeMsgPatcher.Model;
using RevokeMsgPatcher.Modifier;
using RevokeMsgPatcher.Utils;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@ -26,7 +25,7 @@ namespace RevokeMsgPatcher
private string thisVersion;
private bool needUpdate = false;
private string getPatchJsonStatus = "GETTING"; // GETTING FAIL SUCCESS
private string getPatchJsonStatus = "GETTING"; // GETTING FAIL SUCCESS
private readonly GAHelper ga = GAHelper.Instance; // Google Analytics 记录
@ -65,6 +64,7 @@ namespace RevokeMsgPatcher
thisVersion = currentVersion.Substring(0, 3);
currentVersion = " v" + thisVersion;
}
this.Text += currentVersion;
InitModifier();
@ -98,6 +98,7 @@ namespace RevokeMsgPatcher
btnPatch.Enabled = false;
return;
}
modifier.SetVersionLabelAndCategoryCategories(lblVersion, panelCategories);
EnableAllButton(true);
@ -147,6 +148,7 @@ namespace RevokeMsgPatcher
btnPatch.Enabled = false;
return;
}
// b.获取选择的功能 精准匹配返回null // TODO 此处逻辑可以优化 不可完全信任UI信息
List<string> categories = UIController.GetCategoriesFromPanel(panelCategories);
@ -160,6 +162,7 @@ namespace RevokeMsgPatcher
btnRestore.Enabled = modifier.BackupExists();
return;
}
// 20220806 偷懒的特殊逻辑,用于提示用户选择对防撤回功能进行二选一
if (categories.Contains("防撤回(老)") && categories.Contains("防撤回带提示(新)"))
{
@ -216,7 +219,6 @@ namespace RevokeMsgPatcher
modifier.Patch();
ga.RequestPageView($"{enName}/{version}/patch/succ", "补丁安装成功");
MessageBox.Show("补丁安装成功!");
}
catch (BusinessException ex)
{
@ -234,7 +236,6 @@ namespace RevokeMsgPatcher
{
InitEditorsAndUI(txtPath.Text);
}
}
private void txtPath_TextChanged(object sender, EventArgs e)
@ -287,6 +288,7 @@ namespace RevokeMsgPatcher
Console.WriteLine(ex.Message);
MessageBox.Show(ex.Message);
}
EnableAllButton(true);
// 重新计算显示是否能够备份还原、版本和功能
InitEditorsAndUI(txtPath.Text);
@ -299,7 +301,7 @@ namespace RevokeMsgPatcher
private async void FormMain_Load(object sender, EventArgs e)
{
InitNoticeControls(null);
InitNoticeControls(bag);
// 异步获取最新的补丁信息
string json = await HttpUtil.GetPatchJsonAsync();
//string json = null; // local test
@ -345,7 +347,6 @@ namespace RevokeMsgPatcher
lblUpdatePachJson.Text = "[ 软件内置补丁信息已经是最新 ]";
lblUpdatePachJson.ForeColor = Color.RoyalBlue;
}
}
catch (Exception ex)
{
@ -364,6 +365,7 @@ namespace RevokeMsgPatcher
{
tips += "【当前存在最新版本,点击确定进入软件主页下载最新版本。】" + Environment.NewLine + Environment.NewLine;
}
tips += "支持以下版本" + Environment.NewLine;
tips += " ➯ 微信:" + wechatModifier.Config.GetSupportVersionStr() + Environment.NewLine;
tips += " ➯ QQ" + qqModifier.Config.GetSupportVersionStr() + Environment.NewLine;
@ -404,6 +406,7 @@ namespace RevokeMsgPatcher
{
modifier = (QQLiteModifier)rbtQQLite.Tag;
}
EnableAllButton(true);
// 触发了 txtPath_TextChanged 方法 已经调用了 InitEditorsAndUI(txtPath.Text);
// 也就是说 重新计算显示是否能够备份还原、版本和功能
@ -430,6 +433,7 @@ namespace RevokeMsgPatcher
{
return "qqlite";
}
return "none";
}
@ -495,10 +499,12 @@ namespace RevokeMsgPatcher
}
else
{
DialogResult dr = MessageBox.Show($"未在同级目录下找到“微信通用多开工具”,位置:{path},点击“确定”访问微信通用多开工具的主页,你可以在主页上下载到这个工具。", "未找到程序", MessageBoxButtons.OKCancel);
DialogResult dr = MessageBox.Show($"未在同级目录下找到“微信通用多开工具”,位置:{path},点击“确定”访问微信通用多开工具的主页,你可以在主页上下载到这个工具。",
"未找到程序", MessageBoxButtons.OKCancel);
if (dr == DialogResult.OK)
{
Process.Start("https://github.com/huiyadanli/RevokeMsgPatcher/tree/master/RevokeMsgPatcher.MultiInstance");
Process.Start(
"https://github.com/huiyadanli/RevokeMsgPatcher/tree/master/RevokeMsgPatcher.MultiInstance");
}
}
}
@ -512,7 +518,9 @@ namespace RevokeMsgPatcher
{
labelNotice.Text = b.Notice;
// 一行26个中文字 // TODO 这种计算方式并不精确而且高dpi缩放问题会导致很多问题
int height = (int)((Encoding.Default.GetByteCount(b.Notice) / 2 - 26) * 20 * 1.0 / 26);
int lineNum = (int)Math.Ceiling(Encoding.Default.GetByteCount(b.Notice) / 2 * 1.0 / 26);
lineNum = lineNum < 1 ? 1 : lineNum;
int height = lineNum * 26;
labelNotice.Size = new Size(labelNotice.Size.Width, labelNotice.Size.Height + height);
panelNotice.Size = new Size(panelNotice.Size.Width, panelNotice.Size.Height + height);
this.Size = new Size(this.Size.Width, this.Size.Height + panelNotice.Size.Height + 20);
@ -536,4 +544,4 @@ namespace RevokeMsgPatcher
}
}
}
}
}