mirror of
https://github.com/Tichau/FileConverter.git
synced 2026-11-19 17:12:22 +01:00
Added: Icons on context menu elements.
This commit is contained in:
1 parent
de6c8b0e73
commit
2a1bf6bb57
7 files changed
+69
No files matched your search
@@ -59,6 +59,25 @@ namespace FileConverterExtension
|
||||
}
|
||||
}
|
||||
|
||||
private bool DisplayPresetIcons
|
||||
{
|
||||
get
|
||||
{
|
||||
string displayPresetIcons = this.FileConverterRegistryKey.GetValue("DisplayPresetIcons") as string;
|
||||
if (displayPresetIcons == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!bool.TryParse(displayPresetIcons, out bool value))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerable<string> CompatibleInputExtensions
|
||||
{
|
||||
get
|
||||
@@ -104,6 +123,8 @@ namespace FileConverterExtension
|
||||
{
|
||||
this.RefreshPresetList();
|
||||
|
||||
bool displayPresetIcons = this.DisplayPresetIcons;
|
||||
|
||||
ContextMenuStrip menu = new ContextMenuStrip();
|
||||
|
||||
ToolStripMenuItem fileConverterItem = new ToolStripMenuItem
|
||||
@@ -126,6 +147,7 @@ namespace FileConverterExtension
|
||||
{
|
||||
Name = folder,
|
||||
Text = folder,
|
||||
Image = new Icon(Properties.Resources.FolderIcon, SystemInformation.SmallIconSize).ToBitmap(),
|
||||
};
|
||||
|
||||
root.DropDownItems.Add(folderItem);
|
||||
@@ -155,6 +177,10 @@ namespace FileConverterExtension
|
||||
Enabled = preset.Enabled
|
||||
};
|
||||
|
||||
if (displayPresetIcons)
|
||||
{
|
||||
subItem.Image = new Icon(Properties.Resources.PresetIcon, SystemInformation.SmallIconSize).ToBitmap();
|
||||
}
|
||||
|
||||
root.DropDownItems.Add(subItem);
|
||||
subItem.Click += (sender, args) => this.ConvertFiles(preset.FullName);
|
||||
@@ -169,6 +195,7 @@ namespace FileConverterExtension
|
||||
ToolStripMenuItem subItem = new ToolStripMenuItem
|
||||
{
|
||||
Text = "Configure presets...",
|
||||
Image = new Icon(Properties.Resources.SettingsIcon, SystemInformation.SmallIconSize).ToBitmap(),
|
||||
};
|
||||
|
||||
fileConverterItem.DropDownItems.Add(subItem);
|
||||
|
||||
@@ -84,6 +84,9 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Resources\ApplicationIcon.ico" />
|
||||
<Content Include="Resources\FolderIcon.ico" />
|
||||
<Content Include="Resources\PresetIcon.ico" />
|
||||
<Content Include="Resources\SettingsIcon.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
||||
@@ -69,5 +69,35 @@ namespace FileConverterExtension.Properties {
|
||||
return ((System.Drawing.Icon)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
|
||||
/// </summary>
|
||||
internal static System.Drawing.Icon FolderIcon {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("FolderIcon", resourceCulture);
|
||||
return ((System.Drawing.Icon)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
|
||||
/// </summary>
|
||||
internal static System.Drawing.Icon PresetIcon {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("PresetIcon", resourceCulture);
|
||||
return ((System.Drawing.Icon)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
|
||||
/// </summary>
|
||||
internal static System.Drawing.Icon SettingsIcon {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("SettingsIcon", resourceCulture);
|
||||
return ((System.Drawing.Icon)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -121,4 +121,13 @@
|
||||
<data name="ApplicationIcon" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\resources\applicationicon.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="FolderIcon" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\resources\foldericon.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="PresetIcon" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\resources\preseticon.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="SettingsIcon" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\resources\settingsicon.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 34 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 142 KiB |
Reference in new issue
Block a user