!修复高分辨率显示器下首页侧边栏的显示问题

This commit is contained in:
WMJ
2022-06-23 14:47:55 +08:00
parent 97bf3a50d2
commit 7635b3f8a2
2 changed files with 26 additions and 24 deletions
+3 -3
View File
@@ -34,11 +34,11 @@ td {
<h1><a href="func:About">$appName</a></h1>
<table>
<tr>
<td style="border-right: 1px solid blue; padding-right: 5pt; width: 160pt;">
<td style="border-right: 1px solid blue; padding-right: 5pt; width: $sideBarWidth;">
<h2>处理 PDF 文档</h2>
<div>Editor;Editor;修改 PDF 文件;创建或修改 PDF 文档的书签,修改 PDF 文档的设置</div>
<div>DocumentProcessor;Patcher;批量修改 PDF 文件;根据配置批量处理 PDF 文档,生成新的文档</div>
<div>Merger;Merger;合并 PDF 和图片文件;将多个图片和 PDF 文档合并为新的 PDF 文档</div>
<div>Merger;Merger;合并文件;将多个图片和 PDF 文档合并为新的 PDF 文档</div>
<div>Ocr;Ocr;识别图像文本;识别扫描 PDF 文档的文字(需微软 Office 2003或2007的光学字符识别<i>(OCR)</i>引擎支持)</div>
<div>AutoBookmark;BookmarkGenerator;自动生成书签;根据 PDF 的文本样式生成书签文件</div>
<div>Rename;Rename;批量重命名文件;根据 PDF 的文本属性更改文件名</div>
@@ -62,6 +62,6 @@ td {
</td>
</tr>
</table>
<div style="font-size: 9pt">著作权所有:WMJordan;主页:<a href="$AppHomePage">$AppHomePage</a>;电邮:wmjordan@163.com</div>
<div style="font-size: 9pt">著作权所有:WMJordan;主页:<a href="$appHomePage">$appHomePage</a>;电邮:wmjordan@163.com</div>
</body>
</html>
+23 -21
View File
@@ -19,19 +19,19 @@ namespace PDFPatcher
bool ITabContent.CanClose => false;
public override void ExecuteCommand(string commandName, params string[] parameters) {
if (commandName == Commands.Open) {
var n = AppContext.MainForm.ShowPdfFileDialog();
if (n != null) {
AppContext.MainForm.OpenFileWithEditor(n);
}
return;
}
if (commandName == Commands.CleanUpInexistentFiles) {
AppContext.CleanUpInexistentFiles(AppContext.Recent.SourcePdfFiles);
AppContext.CleanUpInexistentFiles(AppContext.Recent.InfoDocuments);
AppContext.CleanUpInexistentFolders(AppContext.Recent.Folders);
RefreshContent();
return;
switch (commandName) {
case Commands.Open:
var n = AppContext.MainForm.ShowPdfFileDialog();
if (n != null) {
AppContext.MainForm.OpenFileWithEditor(n);
}
return;
case Commands.CleanUpInexistentFiles:
AppContext.CleanUpInexistentFiles(AppContext.Recent.SourcePdfFiles);
AppContext.CleanUpInexistentFiles(AppContext.Recent.InfoDocuments);
AppContext.CleanUpInexistentFolders(AppContext.Recent.Folders);
RefreshContent();
return;
}
base.ExecuteCommand(commandName, parameters);
}
@@ -40,7 +40,7 @@ namespace PDFPatcher
InitializeComponent();
Text = "主页";
RefreshContent();
RecentFileItemClicked = (s, args) => { AppContext.MainForm.OpenFileWithEditor(args.ClickedItem.ToolTipText); };
RecentFileItemClicked = (s, args) => AppContext.MainForm.OpenFileWithEditor(args.ClickedItem.ToolTipText);
AllowDrop = true;
}
@@ -68,27 +68,29 @@ namespace PDFPatcher
base.SetupCommand(item);
}
private void RefreshContent() {
void RefreshContent() {
var s = FormHelper.GetDpiScale(this);
_FrontPageBox.Text = __FrontPagePattern
.Replace(Properties.Resources.FrontPage, @"<div><a href=""func:$2""><img src=""res:$1"" />$3</a></div>")
.Replace(Properties.Resources.FrontPage, $@"<div><a href=""func:$2""><img src=""res:$1"" width=""{s * 16}px"" />$3</a></div>")
.Replace("$sideBarWidth", (s * 180).ToText() + "px")
.Replace("$appName", Constants.AppName)
.Replace("$AppHomePage", Constants.AppHomePage)
.Replace("$appHomePage", Constants.AppHomePage)
.Replace("<li></li>", GetLastFileList());
}
private string GetLastFileList() {
string GetLastFileList() {
var i = 0;
return String.Concat(AppContext.Recent.SourcePdfFiles.ConvertAll((s) => FileHelper.IsPathValid(s) && System.IO.File.Exists(s)
return String.Concat(AppContext.Recent.SourcePdfFiles.ConvertAll((s) => FileHelper.IsPathValid(s) && new FilePath(s).ExistsFile
? String.Concat(@"<li><a href=""recent:", i++, "\">", SubstringAfter(s, '\\'), "</a></li>")
: String.Concat(@"<li id=""", i++, "\">", SubstringAfter(s, '\\'), "</li>")));
}
private void _FrontPageBox_LinkClicked(object sender, HtmlLinkClickedEventArgs e) {
void _FrontPageBox_LinkClicked(object sender, HtmlLinkClickedEventArgs e) {
HandleLinkClicked(e.Link);
e.Handled = true;
}
private void _FrontPageBox_ImageLoad(object sender, HtmlImageLoadEventArgs e) {
void _FrontPageBox_ImageLoad(object sender, HtmlImageLoadEventArgs e) {
LoadResourceImage(e);
}