Пример #1
0
        /// <summary>
        /// Updates the location of the form relevant to the selected display
        /// </summary>
        /// <param name="collapse">Display form in a collapsed/shrunk state</param>
        private void RefreshSwitchUI(bool collapse)
        {
            //Only set if form state changing
            if (iscollapsed != collapse)
            {
                //Set required size for form and show/hide panels with relevant controls
                if (!collapse)
                {
                    this.Size = new Size(370, 95); pnlMin.Hide(); pnlMain.Show(); this.ControlBox = true;
                }
                else
                {
                    this.Size = new Size(136, 95); pnlMain.Hide(); pnlMin.Show(); this.ControlBox = false;
                }
            }

            //Test if form is to be collapsed, and set the appropriate position for the form
            if (!collapse)
            {
                int[] windowpos = VNC_Screen.PositionForDisplay(false, RegistryManagement.GetRegistryValue("DisplayDevice")); this.Left = windowpos[0]; this.Top = windowpos[1];
            }
            else
            {
                int[] windowpos = VNC_Screen.PositionForDisplay(true, RegistryManagement.GetRegistryValue("DisplayDevice")); this.Left = windowpos[0]; this.Top = windowpos[1];
            }

            iscollapsed = collapse;
        }