mirror of
https://github.com/Hofknecht/SystemTrayMenu.git
synced 2024-06-20 19:30:31 +12:00
[Feature] Round corners (#236), version 1.0.26.0
This commit is contained in:
parent
f2303853a1
commit
b70f966371
|
@ -24,7 +24,7 @@ namespace SystemTrayMenu.Helper
|
|||
/// <returns>Wether or not the icon was succesfully generated.</returns>
|
||||
public static bool ConvertToIcon(Stream input, Stream output, int size = 16, bool preserveAspectRatio = false)
|
||||
{
|
||||
Bitmap inputBitmap = (Bitmap)Bitmap.FromStream(input);
|
||||
Bitmap inputBitmap = (Bitmap)Image.FromStream(input);
|
||||
if (inputBitmap != null)
|
||||
{
|
||||
int width, height;
|
||||
|
|
29
NativeDllImport/CreateRoundRectRgn.cs
Normal file
29
NativeDllImport/CreateRoundRectRgn.cs
Normal file
|
@ -0,0 +1,29 @@
|
|||
// <copyright file="CreateRoundRectRgn.cs" company="PlaceholderCompany">
|
||||
// Copyright (c) PlaceholderCompany. All rights reserved.
|
||||
// </copyright>
|
||||
|
||||
namespace SystemTrayMenu.DllImports
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
/// <summary>
|
||||
/// wraps the methodcalls to native windows dll's.
|
||||
/// </summary>
|
||||
public static partial class NativeMethods
|
||||
{
|
||||
public static IntPtr CreateRoundCorners(int width, int height, int widthEllipse, int heightEllipse)
|
||||
{
|
||||
return CreateRoundRectRgn(0, 0, width, height, widthEllipse, heightEllipse);
|
||||
}
|
||||
|
||||
[DllImport("Gdi32.dll", EntryPoint = "CreateRoundRectRgn", SetLastError = true, CharSet = CharSet.Unicode)]
|
||||
private static extern IntPtr CreateRoundRectRgn(
|
||||
int nLeftRect, // x-coordinate of upper-left corner
|
||||
int nTopRect, // y-coordinate of upper-left corner
|
||||
int nRightRect, // x-coordinate of lower-right corner
|
||||
int nBottomRect, // y-coordinate of lower-right corner
|
||||
int nWidthEllipse, // width of ellipse
|
||||
int nHeightEllipse); // height of ellipse
|
||||
}
|
||||
}
|
|
@ -39,5 +39,5 @@ using System.Runtime.InteropServices;
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.25.9")]
|
||||
[assembly: AssemblyFileVersion("1.0.25.9")]
|
||||
[assembly: AssemblyVersion("1.0.26.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.26.0")]
|
||||
|
|
16
Properties/Settings.Designer.cs
generated
16
Properties/Settings.Designer.cs
generated
|
@ -283,6 +283,22 @@ namespace SystemTrayMenu.Properties
|
|||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Configuration.SettingsProviderAttribute(typeof(CustomSettingsProvider))]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("true")]
|
||||
public bool RoundCorners
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((bool)(this["RoundCorners"]));
|
||||
}
|
||||
set
|
||||
{
|
||||
this["RoundCorners"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Configuration.SettingsProviderAttribute(typeof(CustomSettingsProvider))]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
|
|
9
Resources/lang.Designer.cs
generated
9
Resources/lang.Designer.cs
generated
|
@ -673,6 +673,15 @@ namespace SystemTrayMenu.Resources {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Round corners.
|
||||
/// </summary>
|
||||
internal static string Round_corners {
|
||||
get {
|
||||
return ResourceManager.GetString("Round corners", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Row height in percentage.
|
||||
/// </summary>
|
||||
|
|
|
@ -399,4 +399,10 @@
|
|||
<data name="Add sample 'Start Menu' folder" xml:space="preserve">
|
||||
<value>Přidejte ukázkovou složku 'Start Menu'</value>
|
||||
</data>
|
||||
<data name="Round corners" xml:space="preserve">
|
||||
<value>Kulaté rohy</value>
|
||||
</data>
|
||||
<data name="Row height in percentage" xml:space="preserve">
|
||||
<value>Výška řádku v procentech</value>
|
||||
</data>
|
||||
</root>
|
|
@ -399,4 +399,10 @@
|
|||
<data name="Add sample 'Start Menu' folder" xml:space="preserve">
|
||||
<value>Beispielordner 'Startmenü' hinzufügen</value>
|
||||
</data>
|
||||
<data name="Round corners" xml:space="preserve">
|
||||
<value>Runde Ecken</value>
|
||||
</data>
|
||||
<data name="Row height in percentage" xml:space="preserve">
|
||||
<value>Zeilenhöhe in Prozent</value>
|
||||
</data>
|
||||
</root>
|
|
@ -399,4 +399,10 @@
|
|||
<data name="Add sample 'Start Menu' folder" xml:space="preserve">
|
||||
<value>Agregar carpeta de muestra 'Menú Inicio'</value>
|
||||
</data>
|
||||
<data name="Round corners" xml:space="preserve">
|
||||
<value>Esquinas redondas</value>
|
||||
</data>
|
||||
<data name="Row height in percentage" xml:space="preserve">
|
||||
<value>Altura de fila en porcentaje</value>
|
||||
</data>
|
||||
</root>
|
|
@ -399,4 +399,10 @@
|
|||
<data name="Add sample 'Start Menu' folder" xml:space="preserve">
|
||||
<value>Ajouter un exemple de dossier 'Start Menu'</value>
|
||||
</data>
|
||||
<data name="Round corners" xml:space="preserve">
|
||||
<value>Coins arrondis</value>
|
||||
</data>
|
||||
<data name="Row height in percentage" xml:space="preserve">
|
||||
<value>Hauteur de ligne en pourcentage</value>
|
||||
</data>
|
||||
</root>
|
|
@ -399,4 +399,10 @@
|
|||
<data name="Add sample 'Start Menu' folder" xml:space="preserve">
|
||||
<value>Aggiungi la cartella "Start Menu" di esempio</value>
|
||||
</data>
|
||||
<data name="Round corners" xml:space="preserve">
|
||||
<value>Angoli arrotondati</value>
|
||||
</data>
|
||||
<data name="Row height in percentage" xml:space="preserve">
|
||||
<value>Altezza riga in percentuale</value>
|
||||
</data>
|
||||
</root>
|
|
@ -399,4 +399,10 @@
|
|||
<data name="Add sample 'Start Menu' folder" xml:space="preserve">
|
||||
<value>サンプルの「スタートメニュー」フォルダを追加します</value>
|
||||
</data>
|
||||
<data name="Round corners" xml:space="preserve">
|
||||
<value>丸い角</value>
|
||||
</data>
|
||||
<data name="Row height in percentage" xml:space="preserve">
|
||||
<value>行の高さ(パーセンテージ)</value>
|
||||
</data>
|
||||
</root>
|
|
@ -399,4 +399,10 @@
|
|||
<data name="Add sample 'Start Menu' folder" xml:space="preserve">
|
||||
<value>샘플 '시작 메뉴' 폴더 추가</value>
|
||||
</data>
|
||||
<data name="Round corners" xml:space="preserve">
|
||||
<value>둥근 모서리</value>
|
||||
</data>
|
||||
<data name="Row height in percentage" xml:space="preserve">
|
||||
<value>행 높이(%)</value>
|
||||
</data>
|
||||
</root>
|
|
@ -399,4 +399,10 @@
|
|||
<data name="Add sample 'Start Menu' folder" xml:space="preserve">
|
||||
<value>Voorbeeldmap 'Start Menu' toevoegen</value>
|
||||
</data>
|
||||
<data name="Round corners" xml:space="preserve">
|
||||
<value>Ronde hoeken</value>
|
||||
</data>
|
||||
<data name="Row height in percentage" xml:space="preserve">
|
||||
<value>Rijhoogte in procenten</value>
|
||||
</data>
|
||||
</root>
|
|
@ -399,4 +399,10 @@
|
|||
<data name="Add sample 'Start Menu' folder" xml:space="preserve">
|
||||
<value>Adicionar amostra da pasta 'Menu Iniciar'</value>
|
||||
</data>
|
||||
<data name="Round corners" xml:space="preserve">
|
||||
<value>Cantos arredondados</value>
|
||||
</data>
|
||||
<data name="Row height in percentage" xml:space="preserve">
|
||||
<value>Altura da linha em porcentagem</value>
|
||||
</data>
|
||||
</root>
|
|
@ -402,4 +402,7 @@
|
|||
<data name="Row height in percentage" xml:space="preserve">
|
||||
<value>Row height in percentage</value>
|
||||
</data>
|
||||
<data name="Round corners" xml:space="preserve">
|
||||
<value>Round corners</value>
|
||||
</data>
|
||||
</root>
|
|
@ -399,4 +399,10 @@
|
|||
<data name="Add sample 'Start Menu' folder" xml:space="preserve">
|
||||
<value>Добавить образец папки "Меню Пуск"</value>
|
||||
</data>
|
||||
<data name="Round corners" xml:space="preserve">
|
||||
<value>Закругленные углы</value>
|
||||
</data>
|
||||
<data name="Row height in percentage" xml:space="preserve">
|
||||
<value>Высота строки в процентах</value>
|
||||
</data>
|
||||
</root>
|
|
@ -399,4 +399,10 @@
|
|||
<data name="Add sample 'Start Menu' folder" xml:space="preserve">
|
||||
<value>Örnek 'Başlat Menüsü' klasörü ekleyin</value>
|
||||
</data>
|
||||
<data name="Round corners" xml:space="preserve">
|
||||
<value>Yuvarlak köşeler</value>
|
||||
</data>
|
||||
<data name="Row height in percentage" xml:space="preserve">
|
||||
<value>Yüzde olarak satır yüksekliği</value>
|
||||
</data>
|
||||
</root>
|
|
@ -399,4 +399,10 @@
|
|||
<data name="Add sample 'Start Menu' folder" xml:space="preserve">
|
||||
<value>Thêm thư mục 'Start Menu' mẫu</value>
|
||||
</data>
|
||||
<data name="Round corners" xml:space="preserve">
|
||||
<value>Góc tròn</value>
|
||||
</data>
|
||||
<data name="Row height in percentage" xml:space="preserve">
|
||||
<value>Chiều cao hàng tính bằng phần trăm</value>
|
||||
</data>
|
||||
</root>
|
|
@ -399,4 +399,10 @@
|
|||
<data name="Add sample 'Start Menu' folder" xml:space="preserve">
|
||||
<value>添加示例“开始菜单”文件夹</value>
|
||||
</data>
|
||||
<data name="Round corners" xml:space="preserve">
|
||||
<value>圆角</value>
|
||||
</data>
|
||||
<data name="Row height in percentage" xml:space="preserve">
|
||||
<value>行高百分比</value>
|
||||
</data>
|
||||
</root>
|
|
@ -479,6 +479,11 @@ namespace SystemTrayMenu.UserInterface
|
|||
|
||||
// Update position
|
||||
Location = new Point(x, y);
|
||||
|
||||
if (Properties.Settings.Default.RoundCorners)
|
||||
{
|
||||
Region = Region.FromHrgn(NativeMethods.CreateRoundCorners(Width, Height + 1, 15, 15));
|
||||
}
|
||||
}
|
||||
|
||||
internal void KeyPressedSearch(string letter)
|
||||
|
|
23
UserInterface/SettingsForm.Designer.cs
generated
23
UserInterface/SettingsForm.Designer.cs
generated
|
@ -85,6 +85,7 @@ namespace SystemTrayMenu.UserInterface
|
|||
this.checkBoxOpenItemWithOneClick = new System.Windows.Forms.CheckBox();
|
||||
this.groupBoxSizeAndLocation = new System.Windows.Forms.GroupBox();
|
||||
this.tableLayoutPanelSizeAndLocation = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.checkBoxRoundCorners = new System.Windows.Forms.CheckBox();
|
||||
this.tableLayoutPanel11 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.numericUpDownRowHeighteInPercentage = new System.Windows.Forms.NumericUpDown();
|
||||
this.labelRowHeightInPercentage = new System.Windows.Forms.Label();
|
||||
|
@ -1225,7 +1226,7 @@ namespace SystemTrayMenu.UserInterface
|
|||
this.groupBoxSizeAndLocation.MinimumSize = new System.Drawing.Size(400, 0);
|
||||
this.groupBoxSizeAndLocation.Name = "groupBoxSizeAndLocation";
|
||||
this.groupBoxSizeAndLocation.Padding = new System.Windows.Forms.Padding(3, 3, 3, 6);
|
||||
this.groupBoxSizeAndLocation.Size = new System.Drawing.Size(400, 216);
|
||||
this.groupBoxSizeAndLocation.Size = new System.Drawing.Size(400, 241);
|
||||
this.groupBoxSizeAndLocation.TabIndex = 0;
|
||||
this.groupBoxSizeAndLocation.TabStop = false;
|
||||
this.groupBoxSizeAndLocation.Text = "groupBoxSizeAndLocation";
|
||||
|
@ -1236,6 +1237,7 @@ namespace SystemTrayMenu.UserInterface
|
|||
this.tableLayoutPanelSizeAndLocation.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.tableLayoutPanelSizeAndLocation.ColumnCount = 1;
|
||||
this.tableLayoutPanelSizeAndLocation.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanelSizeAndLocation.Controls.Add(this.checkBoxRoundCorners, 0, 7);
|
||||
this.tableLayoutPanelSizeAndLocation.Controls.Add(this.tableLayoutPanel11, 0, 1);
|
||||
this.tableLayoutPanelSizeAndLocation.Controls.Add(this.tableLayoutPanel2, 0, 0);
|
||||
this.tableLayoutPanelSizeAndLocation.Controls.Add(this.checkBoxAppearAtTheBottomLeft, 0, 6);
|
||||
|
@ -1246,7 +1248,7 @@ namespace SystemTrayMenu.UserInterface
|
|||
this.tableLayoutPanelSizeAndLocation.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tableLayoutPanelSizeAndLocation.Location = new System.Drawing.Point(3, 19);
|
||||
this.tableLayoutPanelSizeAndLocation.Name = "tableLayoutPanelSizeAndLocation";
|
||||
this.tableLayoutPanelSizeAndLocation.RowCount = 7;
|
||||
this.tableLayoutPanelSizeAndLocation.RowCount = 8;
|
||||
this.tableLayoutPanelSizeAndLocation.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanelSizeAndLocation.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanelSizeAndLocation.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
|
@ -1254,9 +1256,21 @@ namespace SystemTrayMenu.UserInterface
|
|||
this.tableLayoutPanelSizeAndLocation.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanelSizeAndLocation.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanelSizeAndLocation.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanelSizeAndLocation.Size = new System.Drawing.Size(394, 191);
|
||||
this.tableLayoutPanelSizeAndLocation.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.tableLayoutPanelSizeAndLocation.Size = new System.Drawing.Size(394, 216);
|
||||
this.tableLayoutPanelSizeAndLocation.TabIndex = 0;
|
||||
//
|
||||
// checkBoxRoundCorners
|
||||
//
|
||||
this.checkBoxRoundCorners.AutoSize = true;
|
||||
this.checkBoxRoundCorners.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.checkBoxRoundCorners.Location = new System.Drawing.Point(3, 194);
|
||||
this.checkBoxRoundCorners.Name = "checkBoxRoundCorners";
|
||||
this.checkBoxRoundCorners.Size = new System.Drawing.Size(388, 19);
|
||||
this.checkBoxRoundCorners.TabIndex = 4;
|
||||
this.checkBoxRoundCorners.Text = "checkBoxRoundCorners";
|
||||
this.checkBoxRoundCorners.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// tableLayoutPanel11
|
||||
//
|
||||
this.tableLayoutPanel11.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
|
@ -1444,7 +1458,7 @@ namespace SystemTrayMenu.UserInterface
|
|||
//
|
||||
this.buttonAdvancedDefault.AutoSize = true;
|
||||
this.buttonAdvancedDefault.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.buttonAdvancedDefault.Location = new System.Drawing.Point(9, 284);
|
||||
this.buttonAdvancedDefault.Location = new System.Drawing.Point(9, 309);
|
||||
this.buttonAdvancedDefault.Margin = new System.Windows.Forms.Padding(9, 9, 3, 9);
|
||||
this.buttonAdvancedDefault.MinimumSize = new System.Drawing.Size(75, 25);
|
||||
this.buttonAdvancedDefault.Name = "buttonAdvancedDefault";
|
||||
|
@ -4714,5 +4728,6 @@ namespace SystemTrayMenu.UserInterface
|
|||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel10;
|
||||
private System.Windows.Forms.NumericUpDown numericUpDown1;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.CheckBox checkBoxRoundCorners;
|
||||
}
|
||||
}
|
|
@ -151,6 +151,7 @@ namespace SystemTrayMenu.UserInterface
|
|||
checkBoxAppearAtMouseLocation.Text = Translator.GetText("Appear at mouse location");
|
||||
checkBoxShowInTaskbar.Text = Translator.GetText("Show in Taskbar");
|
||||
checkBoxAppearAtTheBottomLeft.Text = Translator.GetText("Appear at the bottom left");
|
||||
checkBoxRoundCorners.Text = Translator.GetText("Round corners");
|
||||
buttonAdvancedDefault.Text = Translator.GetText("Default");
|
||||
groupBoxStaysOpen.Text = Translator.GetText("Stays open");
|
||||
checkBoxStayOpenWhenItemClicked.Text = Translator.GetText("If an item was clicked");
|
||||
|
@ -362,6 +363,7 @@ namespace SystemTrayMenu.UserInterface
|
|||
checkBoxAppearAtMouseLocation.Checked = Settings.Default.AppearAtMouseLocation;
|
||||
checkBoxShowInTaskbar.Checked = Settings.Default.ShowInTaskbar;
|
||||
checkBoxAppearAtTheBottomLeft.Checked = Settings.Default.AppearAtTheBottomLeft;
|
||||
checkBoxRoundCorners.Checked = Settings.Default.RoundCorners;
|
||||
|
||||
checkBoxStayOpenWhenItemClicked.Checked = Settings.Default.StaysOpenWhenItemClicked;
|
||||
checkBoxStayOpenWhenFocusLost.Checked = Settings.Default.StaysOpenWhenFocusLost;
|
||||
|
@ -722,6 +724,7 @@ namespace SystemTrayMenu.UserInterface
|
|||
Settings.Default.MaximumMenuHeight = (int)numericUpDownMenuHeight.Value;
|
||||
Settings.Default.ShowInTaskbar = checkBoxShowInTaskbar.Checked;
|
||||
Settings.Default.AppearAtTheBottomLeft = checkBoxAppearAtTheBottomLeft.Checked;
|
||||
Settings.Default.RoundCorners = checkBoxRoundCorners.Checked;
|
||||
Settings.Default.StaysOpenWhenItemClicked = checkBoxStayOpenWhenItemClicked.Checked;
|
||||
Settings.Default.StaysOpenWhenFocusLost = checkBoxStayOpenWhenFocusLost.Checked;
|
||||
Settings.Default.TimeUntilCloses = (int)numericUpDownTimeUntilClose.Value;
|
||||
|
@ -970,6 +973,7 @@ namespace SystemTrayMenu.UserInterface
|
|||
numericUpDownMenuHeight.Value = 600;
|
||||
checkBoxShowInTaskbar.Checked = false;
|
||||
checkBoxAppearAtTheBottomLeft.Checked = false;
|
||||
checkBoxRoundCorners.Checked = true;
|
||||
}
|
||||
|
||||
private void CheckBoxStayOpenWhenFocusLost_CheckedChanged(object sender, EventArgs e)
|
||||
|
|
|
@ -42,7 +42,6 @@ namespace SystemTrayMenu.Utilities
|
|||
|
||||
public static void Dispose(bool includingMainMenu = true)
|
||||
{
|
||||
|
||||
if (includingMainMenu)
|
||||
{
|
||||
foreach (Icon icon in DictIconCacheMainMenu.Values)
|
||||
|
|
Loading…
Reference in a new issue