public void ShowAll(bool useDummy) { /// NotifyIconクリック時は一旦dummyをアクティブ化しないと /// 非アクティブ時にShowWindow()でfusenが前に出てこない var dummy = default(Form); if (useDummy) { dummy = new Form(); dummy.ShowInTaskbar = false; dummy.StartPosition = FormStartPosition.Manual; dummy.Location = new Point(-2000, -2000); dummy.Size = new Size(); dummy.WindowState = FormWindowState.Minimized; dummy.Show(); dummy.Activate(); } foreach (var fusen in _infoToForms.Values) { //User32PI.SetForegroundWindow(fusen.Handle); User32PI.ShowWindow(fusen.Handle, WindowShowStyle.ShowNoActivate); } if (dummy != null) { dummy.Dispose(); } }
protected override void OnActivated(EventArgs e) { base.OnActivated(e); if (_isShown && _toolStripForm != null) { RelocateToolStripForm(); User32PI.ShowWindow(_toolStripForm.Handle, WindowShowStyle.ShowNoActivate); } }
// ------------------------------ // private // ------------------------------ private void InitToolStripForm(bool show) { _toolStripForm = new ToolStripForm(); _toolStripForm.TargetForm = this; InitDropDowns(); InitMemoMarkToolStripSplitButton(); InitToolStripHandlers(); if (_toolStripForm._fontNameToolStripComboBox.Items.Count == 0) { _UILogic.InitFontNameToolStripComboBox(_toolStripForm._fontNameToolStripComboBox.ComboBox); _UILogic.InitFontSizeToolStripComboBox(_toolStripForm._fontSizeToolStripComboBox.ComboBox); } RelocateToolStripForm(); UpdateToolStrip(); if (show) { User32PI.ShowWindow(_toolStripForm.Handle, WindowShowStyle.ShowNoActivate); } }