mirror of
https://github.com/terrymacdonald/DisplayMagician.git
synced 2024-08-30 18:32:20 +00:00
Icons added for the shell extension context menu
This commit is contained in:
parent
fc896f9692
commit
6e704ca74d
@ -15,15 +15,15 @@ namespace HeliosDisplayManagement.ShellExtension
|
||||
private static ToolStripMenuItem CreateProfileMenu(Profile profile)
|
||||
{
|
||||
var profileMenu = new ToolStripMenuItem(profile.Name, new ProfileIcon(profile).ToBitmap(16, 16));
|
||||
profileMenu.DropDownItems.Add(new ToolStripMenuItem(Language.Apply, null,
|
||||
profileMenu.DropDownItems.Add(new ToolStripMenuItem(Language.Apply, Properties.Resources.Run_x16,
|
||||
(sender, args) => HeliosDisplayManagement.Open(HeliosStartupAction.SwitchProfile, profile))
|
||||
{
|
||||
Enabled = profile.IsPossible && !profile.IsActive
|
||||
});
|
||||
profileMenu.DropDownItems.Add(new ToolStripSeparator());
|
||||
profileMenu.DropDownItems.Add(new ToolStripMenuItem(Language.Edit, null,
|
||||
profileMenu.DropDownItems.Add(new ToolStripMenuItem(Language.Edit, Properties.Resources.Edit_x16,
|
||||
(sender, args) => HeliosDisplayManagement.Open(HeliosStartupAction.EditProfile, profile)));
|
||||
profileMenu.DropDownItems.Add(new ToolStripMenuItem(Language.Create_Shortcut, null,
|
||||
profileMenu.DropDownItems.Add(new ToolStripMenuItem(Language.Create_Shortcut, Properties.Resources.Shortcut_x16,
|
||||
(sender, args) => HeliosDisplayManagement.Open(HeliosStartupAction.CreateShortcut, profile)));
|
||||
return profileMenu;
|
||||
}
|
||||
|
@ -80,8 +80,14 @@
|
||||
<Link>srm.exe</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<None Include="Resources\Run_x16.png" />
|
||||
<None Include="Resources\Shortcut_x16.png" />
|
||||
<None Include="Resources\Edit_x16.png" />
|
||||
<None Include="Resources\Icon_x16.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Shield.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
@ -40,18 +40,18 @@ namespace HeliosDisplayManagement.ShellExtension
|
||||
private ToolStripMenuItem CreateProfileMenu(Profile profile)
|
||||
{
|
||||
var profileMenu = new ToolStripMenuItem(profile.Name, new ProfileIcon(profile).ToBitmap(16, 16));
|
||||
profileMenu.DropDownItems.Add(new ToolStripMenuItem(Language.Run, null,
|
||||
profileMenu.DropDownItems.Add(new ToolStripMenuItem(Language.Run, Properties.Resources.Run_x16,
|
||||
(sender, args) =>
|
||||
HeliosDisplayManagement.Open(HeliosStartupAction.SwitchProfile, profile,
|
||||
SelectedItemPaths.FirstOrDefault())));
|
||||
profileMenu.DropDownItems.Add(new ToolStripMenuItem(Language.Run_as_administrator, null,
|
||||
profileMenu.DropDownItems.Add(new ToolStripMenuItem(Language.Run_as_administrator, Shield.SmallIcon,
|
||||
(sender, args) =>
|
||||
HeliosDisplayManagement.Open(HeliosStartupAction.SwitchProfile, profile,
|
||||
SelectedItemPaths.FirstOrDefault(), true)));
|
||||
profileMenu.DropDownItems.Add(new ToolStripSeparator());
|
||||
profileMenu.DropDownItems.Add(new ToolStripMenuItem(Language.Edit, null,
|
||||
(sender, args) => HeliosDisplayManagement.Open(HeliosStartupAction.EditProfile, profile)));
|
||||
profileMenu.DropDownItems.Add(new ToolStripMenuItem(Language.Create_Shortcut, null,
|
||||
profileMenu.DropDownItems.Add(new ToolStripMenuItem(Language.Create_Shortcut, Properties.Resources.Shortcut_x16,
|
||||
(sender, args) =>
|
||||
HeliosDisplayManagement.Open(HeliosStartupAction.CreateShortcut, profile,
|
||||
SelectedItemPaths.FirstOrDefault())));
|
||||
|
@ -42,14 +42,14 @@ namespace HeliosDisplayManagement.ShellExtension
|
||||
{
|
||||
var appId = ParseSteamAppId();
|
||||
var profileMenu = new ToolStripMenuItem(profile.Name, new ProfileIcon(profile).ToBitmap(16, 16));
|
||||
profileMenu.DropDownItems.Add(new ToolStripMenuItem(Language.Run, null,
|
||||
profileMenu.DropDownItems.Add(new ToolStripMenuItem(Language.Run, Properties.Resources.Run_x16,
|
||||
(sender, args) =>
|
||||
HeliosDisplayManagement.OpenSteamGame(HeliosStartupAction.SwitchProfile, profile,
|
||||
appId)));
|
||||
profileMenu.DropDownItems.Add(new ToolStripSeparator());
|
||||
profileMenu.DropDownItems.Add(new ToolStripMenuItem(Language.Edit, null,
|
||||
(sender, args) => HeliosDisplayManagement.Open(HeliosStartupAction.EditProfile, profile)));
|
||||
profileMenu.DropDownItems.Add(new ToolStripMenuItem(Language.Create_Shortcut, null,
|
||||
profileMenu.DropDownItems.Add(new ToolStripMenuItem(Language.Create_Shortcut, Properties.Resources.Shortcut_x16,
|
||||
(sender, args) =>
|
||||
HeliosDisplayManagement.OpenSteamGame(HeliosStartupAction.CreateShortcut, profile,
|
||||
appId)));
|
||||
|
@ -60,6 +60,16 @@ namespace HeliosDisplayManagement.ShellExtension.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Edit_x16 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Edit_x16", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
@ -69,5 +79,25 @@ namespace HeliosDisplayManagement.ShellExtension.Properties {
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Run_x16 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Run_x16", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Shortcut_x16 {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Shortcut_x16", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -118,7 +118,16 @@
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="Edit_x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Edit_x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Icon_x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Icon_x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Run_x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Run_x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Shortcut_x16" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Shortcut_x16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
BIN
HeliosDisplayManagement.ShellExtension/Resources/Edit_x16.png
Normal file
BIN
HeliosDisplayManagement.ShellExtension/Resources/Edit_x16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
BIN
HeliosDisplayManagement.ShellExtension/Resources/Run_x16.png
Normal file
BIN
HeliosDisplayManagement.ShellExtension/Resources/Run_x16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
26
HeliosDisplayManagement.ShellExtension/Shield.cs
Normal file
26
HeliosDisplayManagement.ShellExtension/Shield.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace HeliosDisplayManagement.ShellExtension
|
||||
{
|
||||
public static class Shield
|
||||
{
|
||||
private static Bitmap _smallIcon;
|
||||
|
||||
public static Bitmap SmallIcon
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_smallIcon != null)
|
||||
return _smallIcon;
|
||||
var iconSize = SystemInformation.SmallIconSize;
|
||||
_smallIcon = new Bitmap(iconSize.Width, iconSize.Height);
|
||||
using (var g = Graphics.FromImage(_smallIcon))
|
||||
{
|
||||
g.DrawIcon(SystemIcons.Shield, new Rectangle(Point.Empty, iconSize));
|
||||
}
|
||||
return _smallIcon;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user