Пример #1
0
        public frmSMeter(System.Drawing.Rectangle initPosition, Console the_console)
        {
            InitializeComponent();
            // this is the default
            console            = the_console;
            this.WindowState   = FormWindowState.Normal;
            this.StartPosition = FormStartPosition.WindowsDefaultBounds;
            this.Owner         = the_console;

            // Properties.Settings.Default.Reset();

            // this.ControlBox = false;
            // this.Text = String.Empty;
            // this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            Text            = string.Empty;
            ControlBox      = false;
            FormBorderStyle = FormBorderStyle.SizableToolWindow;

            if (Settings.Default.WindowPosition == Rectangle.Empty)
            {
                initPosition.Height            += (int)((float)initPosition.Height / (float)0.7);
                initPosition.Width             *= 2;
                initPosition.X                 -= initPosition.Width * 2;
                Settings.Default.WindowPosition = initPosition;
            }
            // check if the saved bounds are nonzero and visible on any screen
            if (Settings.Default.WindowPosition != Rectangle.Empty &&
                IsVisibleOnAnyScreen(Settings.Default.WindowPosition))
            {
                // first set the bounds
                this.StartPosition = FormStartPosition.Manual;
                this.DesktopBounds = Settings.Default.WindowPosition;

                // afterwards set the window state to the saved value (which could be Maximized)
                this.WindowState = Settings.Default.WindowState;
            }
            else
            {
                // this resets the upper left corner of the window to windows standards
                StartPosition = FormStartPosition.WindowsDefaultLocation;

                // we can still apply the saved size
                Size = Settings.Default.WindowPosition.Size;
            }
            windowInitialized = true;
            Settings.Default.BigSMeterOpen = true;
            BigSMeter.ToggleBackGroundImage(Settings.Default.SMeterBackgroundImg);

            Settings.Default.Save();
            if (Settings.Default.TopMost)
            {
                this.TopMost = true;
            }

            if (TopMost)
            {
                this.Owner = null;
            }
            else
            {
                this.Owner = console;
            }

            this.alwaysOnTopToolStripMenuItem.Checked = this.TopMost;
        }
Пример #2
0
 public static void setConsole(Thetis.Console console)
 {
     m_console = console;
 }
 public helpers(Console c)
 {
     m_console = c;
 }