From 012eeaa65f217be22979b9298709cc4a0f594f28 Mon Sep 17 00:00:00 2001 From: Alexander Horner <33007665+alexhorner@users.noreply.github.com> Date: Tue, 6 Dec 2022 23:25:07 +0000 Subject: [PATCH] Enable .NET Core system aware DPI mode Fix Exit button in window menu Cleanup --- ntfysh_client/Form1.Designer.cs | 52 ++++++++++++++++-------- ntfysh_client/Form1.cs | 6 +++ ntfysh_client/Form1.resx | 72 +++------------------------------ ntfysh_client/Program.cs | 2 +- 4 files changed, 48 insertions(+), 84 deletions(-) diff --git a/ntfysh_client/Form1.Designer.cs b/ntfysh_client/Form1.Designer.cs index 91caa7e..89f66c2 100644 --- a/ntfysh_client/Form1.Designer.cs +++ b/ntfysh_client/Form1.Designer.cs @@ -53,9 +53,10 @@ namespace ntfysh_client // subscribeNewTopic // this.subscribeNewTopic.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.subscribeNewTopic.Location = new System.Drawing.Point(236, 50); + this.subscribeNewTopic.Location = new System.Drawing.Point(275, 58); + this.subscribeNewTopic.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.subscribeNewTopic.Name = "subscribeNewTopic"; - this.subscribeNewTopic.Size = new System.Drawing.Size(105, 23); + this.subscribeNewTopic.Size = new System.Drawing.Size(122, 27); this.subscribeNewTopic.TabIndex = 2; this.subscribeNewTopic.Text = "Add"; this.subscribeNewTopic.UseVisualStyleBackColor = true; @@ -65,9 +66,10 @@ namespace ntfysh_client // this.removeSelectedTopics.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.removeSelectedTopics.Enabled = false; - this.removeSelectedTopics.Location = new System.Drawing.Point(236, 79); + this.removeSelectedTopics.Location = new System.Drawing.Point(275, 91); + this.removeSelectedTopics.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.removeSelectedTopics.Name = "removeSelectedTopics"; - this.removeSelectedTopics.Size = new System.Drawing.Size(105, 23); + this.removeSelectedTopics.Size = new System.Drawing.Size(122, 27); this.removeSelectedTopics.TabIndex = 0; this.removeSelectedTopics.Text = "Remove selected"; this.removeSelectedTopics.UseVisualStyleBackColor = true; @@ -75,12 +77,15 @@ namespace ntfysh_client // // notificationTopics // - this.notificationTopics.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.notificationTopics.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.notificationTopics.FormattingEnabled = true; - this.notificationTopics.Location = new System.Drawing.Point(12, 50); + this.notificationTopics.ItemHeight = 15; + this.notificationTopics.Location = new System.Drawing.Point(14, 58); + this.notificationTopics.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.notificationTopics.Name = "notificationTopics"; this.notificationTopics.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended; - this.notificationTopics.Size = new System.Drawing.Size(145, 173); + this.notificationTopics.Size = new System.Drawing.Size(168, 199); this.notificationTopics.TabIndex = 3; this.notificationTopics.Click += new System.EventHandler(this.notificationTopics_Click); this.notificationTopics.SelectedValueChanged += new System.EventHandler(this.notificationTopics_SelectedValueChanged); @@ -95,7 +100,9 @@ namespace ntfysh_client // // trayContextMenu // - this.trayContextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.showControlWindowToolStripMenuItem, this.exitToolStripMenuItem }); + this.trayContextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.showControlWindowToolStripMenuItem, + this.exitToolStripMenuItem}); this.trayContextMenu.Name = "trayContextMenu"; this.trayContextMenu.Size = new System.Drawing.Size(190, 48); // @@ -118,16 +125,20 @@ namespace ntfysh_client // menuStrip1 // this.menuStrip1.BackColor = System.Drawing.Color.White; - this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.fileToolStripMenuItem, this.helpToolStripMenuItem }); + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.fileToolStripMenuItem, + this.helpToolStripMenuItem}); this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Size = new System.Drawing.Size(353, 24); + this.menuStrip1.Padding = new System.Windows.Forms.Padding(7, 2, 0, 2); + this.menuStrip1.Size = new System.Drawing.Size(412, 24); this.menuStrip1.TabIndex = 4; this.menuStrip1.Text = "menuStrip1"; // // fileToolStripMenuItem // - this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.exitToolStripMenuItem1 }); + this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.exitToolStripMenuItem1}); this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); this.fileToolStripMenuItem.Text = "File"; @@ -136,12 +147,16 @@ namespace ntfysh_client // this.exitToolStripMenuItem1.Image = ((System.Drawing.Image)(resources.GetObject("exitToolStripMenuItem1.Image"))); this.exitToolStripMenuItem1.Name = "exitToolStripMenuItem1"; - this.exitToolStripMenuItem1.Size = new System.Drawing.Size(93, 22); + this.exitToolStripMenuItem1.Size = new System.Drawing.Size(180, 22); this.exitToolStripMenuItem1.Text = "Exit"; + this.exitToolStripMenuItem1.Click += new System.EventHandler(this.exitToolStripMenuItem1_Click); // // helpToolStripMenuItem // - this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.ntfyshWebsiteToolStripMenuItem, this.toolStripMenuItem1, this.aboutToolStripMenuItem }); + this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.ntfyshWebsiteToolStripMenuItem, + this.toolStripMenuItem1, + this.aboutToolStripMenuItem}); this.helpToolStripMenuItem.Name = "helpToolStripMenuItem"; this.helpToolStripMenuItem.Size = new System.Drawing.Size(44, 20); this.helpToolStripMenuItem.Text = "Help"; @@ -170,18 +185,19 @@ namespace ntfysh_client // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(12, 34); + this.label1.Location = new System.Drawing.Point(14, 39); + this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(145, 13); + this.label1.Size = new System.Drawing.Size(164, 15); this.label1.TabIndex = 1; this.label1.Text = "Subscribed notification topics"; // // Form1 // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.White; - this.ClientSize = new System.Drawing.Size(353, 236); + this.ClientSize = new System.Drawing.Size(412, 272); this.Controls.Add(this.menuStrip1); this.Controls.Add(this.notificationTopics); this.Controls.Add(this.removeSelectedTopics); @@ -191,6 +207,7 @@ namespace ntfysh_client this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.KeyPreview = true; this.MainMenuStrip = this.menuStrip1; + this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "Form1"; @@ -204,6 +221,7 @@ namespace ntfysh_client this.menuStrip1.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); + } #endregion diff --git a/ntfysh_client/Form1.cs b/ntfysh_client/Form1.cs index 5666191..2d51bf1 100644 --- a/ntfysh_client/Form1.cs +++ b/ntfysh_client/Form1.cs @@ -212,5 +212,11 @@ namespace ntfysh_client using AboutBox d = new AboutBox(); d.ShowDialog(); } + + private void exitToolStripMenuItem1_Click(object sender, EventArgs e) + { + _trueExit = true; + Close(); + } } } diff --git a/ntfysh_client/Form1.resx b/ntfysh_client/Form1.resx index 7adc2ca..f988851 100644 --- a/ntfysh_client/Form1.resx +++ b/ntfysh_client/Form1.resx @@ -1,64 +1,4 @@ - - - + @@ -127,7 +67,7 @@ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAA7DAAAOwwHHb6hkAAAAiklE + JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAA7AAAAOwAFq1okJAAAAiklE QVQ4T8WPQQqAIBBFvUOrXIhu3dcZOkqtu5R1ia4SdRDrxyyGGKmBIOGBDL6nmk9WCGE9yUpW0q9Ads7V GuCQ/kHAe79joAEO6dcLFmttpQEO6c+Bvpm2oZ0zwB4zVQBiF8cIsMdMDPCb+G2vA/wgP/z6C6WAhBgo fUFCDGi4BxIGShLpvy5jDoPes/0oNG3VAAAAAElFTkSuQmCC @@ -136,7 +76,7 @@ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6 - JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAA7DAAAOwwHHb6hkAAAAgUlE + JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAA7AAAAOwAFq1okJAAAAgUlE QVQ4T2OgGjjOLq4AZeIFWNWBBI9yib06zC3uABXCCkDyIHVYDTnMI2pzhEvs5VFucSeoEAo4wiNii08e DHAZQshwFICumCTNMADyK1gTl2gJiCYUNlgBSDPQ1v8gGipEPKDIBRSFAa6oIsoQQvGM1xCqpESsglgA seroBRgYAOoOWBJbfVcRAAAAAElFTkSuQmCC @@ -327,7 +267,7 @@ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB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WXMAAA7AAAAOwAFq1okJAAAAwUlE QVQ4T2OgClBUVHwAxP9JxA+g2sEG/JeTk5MkBYP0QLVTwQAFBYXHIAFSMEgPVDvYBfulpKSEScEgPVDt dDIA6OTNQHX/YXysBjAxMcUxMjKuBrGB9DIgPxqmARhwOUBD3sD4WA0QERGRBHLvCwoKygLpm6KiohIw DVBNz5HY2L0AtHkOEE8F4okgvoyMjDSSJsIGsLOzuwKFfnBycppJS0vLAJ39BUQTbQA6RnYBMkY3YAVI diff --git a/ntfysh_client/Program.cs b/ntfysh_client/Program.cs index 6f47948..a8feec7 100644 --- a/ntfysh_client/Program.cs +++ b/ntfysh_client/Program.cs @@ -16,7 +16,7 @@ namespace ntfysh_client [STAThread] static void Main() { - //Application.SetHighDpiMode(HighDpiMode.SystemAware); + Application.SetHighDpiMode(HighDpiMode.SystemAware); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1(NotificationListener));