/// <summary> /// </summary> /// <param name="serverUri">ホストプロセスとの通信用URL</param> public FormBrowser(string serverUri) { InitializeComponent(); ServerUri = serverUri; StyleSheetApplied = false; _volumeManager = new VolumeManager((uint)System.Diagnostics.Process.GetCurrentProcess().Id); Browser.ReplacedKeyDown += Browser_ReplacedKeyDown; // 音量設定用コントロールの追加 { var control = new NumericUpDown(); control.Name = "ToolMenu_Other_Volume_VolumeControl"; control.Maximum = 100; control.TextAlign = HorizontalAlignment.Right; control.Font = ToolMenu_Other_Volume.Font; control.ValueChanged += ToolMenu_Other_Volume_ValueChanged; control.Tag = false; var host = new ToolStripControlHost(control, "ToolMenu_Other_Volume_VolumeControlHost"); control.Size = new Size(host.Width - control.Margin.Horizontal, host.Height - control.Margin.Vertical); control.Location = new Point(control.Margin.Left, control.Margin.Top); ToolMenu_Other_Volume.DropDownItems.Add(host); } }
/// <summary> /// </summary> /// <param name="serverUri">ホストプロセスとの通信用URL</param> public FormBrowser(string serverUri) { InitializeComponent(); ServerUri = serverUri; StyleSheetApplied = false; _volumeManager = new VolumeManager((uint)System.Diagnostics.Process.GetCurrentProcess().Id); Browser.ReplacedKeyDown += Browser_ReplacedKeyDown; }
/// <summary> /// </summary> /// <param name="serverUri">ホストプロセスとの通信用URL</param> public FormBrowser(string serverUri) { InitializeComponent(); ServerUri = serverUri; StyleSheetApplied = false; _volumeManager = new VolumeManager((uint)Process.GetCurrentProcess().Id); ToolStripManager.Renderer = new CustomToolStripRenderer(new ToolStripBGColor()); // 音量設定用コントロールの追加 { var control = new NumericUpDown(); control.Name = "ToolMenu_Other_Volume_VolumeControl"; control.Maximum = 100; control.TextAlign = HorizontalAlignment.Right; control.Font = ToolMenu_Other_Volume.Font; control.ValueChanged += ToolMenu_Other_Volume_ValueChanged; control.Tag = false; var host = new ToolStripControlHost(control, "ToolMenu_Other_Volume_VolumeControlHost"); control.Size = new Size(host.Width - control.Margin.Horizontal, host.Height - control.Margin.Vertical); control.Location = new Point(control.Margin.Left, control.Margin.Top); ToolMenu_Other_Volume.DropDownItems.Add(host); } // スクリーンショットプレビューコントロールの追加 { double zoomrate = 0.5; var control = new PictureBox(); control.Name = "ToolMenu_Other_LastScreenShot_Image"; control.SizeMode = PictureBoxSizeMode.Zoom; control.Size = new Size((int)(KanColleSize.Width * zoomrate), (int)(KanColleSize.Height * zoomrate)); control.Margin = new Padding(); control.Image = new Bitmap((int)(KanColleSize.Width * zoomrate), (int)(KanColleSize.Height * zoomrate), PixelFormat.Format24bppRgb); using (var g = Graphics.FromImage(control.Image)) { g.Clear(SystemColors.Control); g.DrawString("スクリーンショットをまだ撮影していません。\r\n", Font, Brushes.Black, new Point(4, 4)); } var host = new ToolStripControlHost(control, "ToolMenu_Other_LastScreenShot_ImageHost"); host.Size = new Size(control.Width + control.Margin.Horizontal, control.Height + control.Margin.Vertical); host.AutoSize = false; control.Location = new Point(control.Margin.Left, control.Margin.Top); host.Click += ToolMenu_Other_LastScreenShot_ImageHost_Click; ToolMenu_Other_LastScreenShot.DropDownItems.Insert(0, host); } }
/// <summary> /// </summary> /// <param name="serverUri">ホストプロセスとの通信用URL</param> public FormBrowser(string serverUri) { CultureInfo c = CultureInfo.CurrentCulture; CultureInfo ui = CultureInfo.CurrentUICulture; if (c.Name != "en-US" && c.Name != "ja-JP" && c.Name != "ko-KR") { c = new CultureInfo("en-US"); } if (ui.Name != "en-US" && ui.Name != "ja-JP" && ui.Name != "ko-KR") { ui = new CultureInfo("en-US"); } Thread.CurrentThread.CurrentCulture = c; Thread.CurrentThread.CurrentUICulture = ui; InitializeComponent(); SetUserAgent(); ServerUri = serverUri; StyleSheetApplied = false; _volumeManager = new VolumeManager((uint)System.Diagnostics.Process.GetCurrentProcess().Id); Browser.ReplacedKeyDown += Browser_ReplacedKeyDown; // 音量設定用コントロールの追加 { var control = new NumericUpDown(); control.Name = "ToolMenu_Other_Volume_VolumeControl"; control.Maximum = 100; control.TextAlign = HorizontalAlignment.Right; control.Font = ToolMenu_Other_Volume.Font; control.ValueChanged += ToolMenu_Other_Volume_ValueChanged; control.Tag = false; var host = new ToolStripControlHost(control, "ToolMenu_Other_Volume_VolumeControlHost"); control.Size = new Size(host.Width - control.Margin.Horizontal, host.Height - control.Margin.Vertical); control.Location = new Point(control.Margin.Left, control.Margin.Top); ToolMenu_Other_Volume.DropDownItems.Add(host); } }
private void SetVolumeState() { bool mute; float volume; try { if (_volumeManager == null) { TryGetVolumeManager(); } mute = _volumeManager.IsMute; volume = _volumeManager.Volume * 100; } catch (Exception) { // 音量データ取得不能時 _volumeManager = null; mute = false; volume = 100; } ToolMenu_Mute.Image = ToolMenu_Other_Mute.Image = Icons.Images[mute ? "Browser_Mute" : "Browser_Unmute"]; { var control = ToolMenu_Other_Volume_VolumeControl; control.Tag = false; control.Value = (decimal)volume; control.Tag = true; } Configuration.Volume = volume; Configuration.IsMute = mute; ConfigurationUpdated(); }
/// <summary> /// </summary> /// <param name="serverUri">ホストプロセスとの通信用URL</param> public FormBrowser(string serverUri) { CultureInfo c = CultureInfo.CurrentCulture; CultureInfo ui = CultureInfo.CurrentUICulture; if (c.Name != "en-US" && c.Name != "ja-JP" && c.Name != "ko-KR") { c = new CultureInfo("en-US"); } if (ui.Name != "en-US" && ui.Name != "ja-JP" && ui.Name != "ko-KR") { ui = new CultureInfo("en-US"); } Thread.CurrentThread.CurrentCulture = c; Thread.CurrentThread.CurrentUICulture = ui; InitializeComponent(); ServerUri = serverUri; StyleSheetApplied = false; _volumeManager = new VolumeManager((uint)System.Diagnostics.Process.GetCurrentProcess().Id); Browser.ReplacedKeyDown += Browser_ReplacedKeyDown; }
private void TryGetVolumeManager() { _volumeManager = VolumeManager.CreateInstanceByProcessName("CefSharp.BrowserSubprocess"); }