ACAT.Lib.Core.Utility.Windows.SetTopMost C# (CSharp) Метод

SetTopMost() публичный статический Метод

Sets topmost to true
public static SetTopMost ( Form form, bool topMost = true ) : void
form System.Windows.Forms.Form which form?
topMost bool set to true for topmost, false otherwise
Результат void
        public static void SetTopMost(Form form, bool topMost = true)
        {
            if (form.InvokeRequired)
            {
                form.Invoke(new setTopMost(SetTopMost), form, topMost);
            }
            else
            {
                // need to toggle to false and
                // then to true for this to take effect
                
                if (topMost)
                {
                    form.TopMost = false;
                    form.TopMost = true;
                }
                else
                {
                    form.TopMost = false;
                }
            }
        }

Usage Example

Пример #1
0
        /// <summary>
        /// Docks this scanner to the companian scanner
        /// </summary>
        /// <param name="scanner">companian scanner</param>
        private void dockToScanner(Form scanner)
        {
            if (!Windows.GetVisible(this))
            {
                return;
            }

            if (scanner is IScannerPanel)
            {
                if (((IPanel)scanner).PanelCommon.DisplayMode != DisplayModeTypes.Popup)
                {
                    Windows.DockWithScanner(this, scanner, Context.AppWindowPosition);
                    Windows.SetTopMost(scanner);
                }
            }

            if (Left < 0)
            {
                Left = 0;
            }
        }