diff --git a/App.xaml.cs b/App.xaml.cs index f74b6fd..0cee0c7 100644 --- a/App.xaml.cs +++ b/App.xaml.cs @@ -56,12 +56,8 @@ private App() var engineServer = new EngineServer(Settings.Default.EnginePort); - var contextMenuStrip = new ContextMenuStrip() - { - Renderer = new VolumeIconRenderer(), - }; - var menuItems = contextMenuStrip.Items; - menuItems.Add(new ToolStripMenuItem("終了", image: null, (sender, e) => this.Shutdown())); + var contextMenuStrip = new ContextMenuStrip(); + contextMenuStrip.Items.Add("終了", image: null, (sender, e) => this.Shutdown()); var notifyIcon = new NotifyIcon() { diff --git a/VolumeIconRenderer.cs b/VolumeIconRenderer.cs deleted file mode 100644 index 0882641..0000000 --- a/VolumeIconRenderer.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Drawing; -using System.IO; -using System.Linq; -using System.Windows.Forms; - -namespace Esperecyan.NCVVoicevox; - -/// -/// 「volume」という名前の項目に、スピーカーアイコンを表示します。 -/// -internal class VolumeIconRenderer : ToolStripProfessionalRenderer -{ - private static readonly int Size = 24; - private static readonly Icon Icon; - - static VolumeIconRenderer() - { - VolumeIconRenderer.Icon = IconExtractor.ExtractFromFile( - Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.SystemX86), "DDORes.dll"), - index: 1 - ); - } - - protected override void OnRenderImageMargin(ToolStripRenderEventArgs e) - { - base.OnRenderImageMargin(e); - var volumeItem = e.ToolStrip.Items.Cast().First(item => item.Name == "volume"); - e.Graphics.DrawIcon(VolumeIconRenderer.Icon, new Rectangle( - x: 1, - y: volumeItem.Bounds.Y + volumeItem.Height / 2 - VolumeIconRenderer.Size / 2, - width: VolumeIconRenderer.Size, - height: VolumeIconRenderer.Size - )); - } -}