System.Windows.Forms.Form.CenterToScreen()

Here are the examples of the csharp api class System.Windows.Forms.Form.CenterToScreen() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

16 Examples 7

1. Example

Project: DFAssist
Source File: OverlayFormMove.cs
View license
public new void CenterToScreen()
        {
            base.CenterToScreen();
        }

2. Example

Project: ScpToolkit
Source File: ProfilesForm.cs
View license
public void Reset()
        {
            CenterToScreen();
        }

3. Example

Project: ScpToolkit
Source File: ScpForm.cs
View license
public void Reset()
        {
            CenterToScreen();
        }

4. Example

Project: Athame
Source File: MainForm.cs
View license
private void RestoreFormPositionAndSize()
        {
            if (!IsWithinVisibleBounds(Program.DefaultSettings.Settings.MainWindowPreference.Location) ||
                Program.DefaultSettings.Settings.MainWindowPreference.Location == new Point(0, 0))
            {
                CenterToScreen();
            }
            else
            {
                Location = Program.DefaultSettings.Settings.MainWindowPreference.Location;
            }

            var savedSize = Program.DefaultSettings.Settings.MainWindowPreference.Size;
            if (savedSize.Width < MinimumSize.Width && savedSize.Height < MinimumSize.Height)
            {
                Program.DefaultSettings.Settings.MainWindowPreference.Size = savedSize = MinimumSize;
            }
            Size = savedSize;
        }

5. Example

Project: pair-trading-view
Source File: MainWindow.cs
View license
private void MainWindow_Load(object sender, EventArgs e)
        {
            AppStartWindow startWin = new AppStartWindow();
            startWin.ShowDialog();

            stocks = startWin.Stocks;

            if (stocks == null)
            {
                Close();
            }
            else if (stocks.Length == 0)
            {
                MessageBox.Show("No input data. App will be closed.");
                Close();
            }
            else
            {
                pairs = FinancialPair.CreateMany(stocks);
                listView.Items.Clear();
                listView.Update(pairs);
                CenterToScreen();
            }
        }

6. Example

Project: OSUplayer
Source File: Main.cs
View license
private void Main_Shown(object sender, EventArgs e)
        {
            CenterToScreen();
            Core.Init(Main_Main_Display.Handle, Main_Main_Display.Size);
            SetForm();
            RefreshList();
            VisibleChanged += Main_VisibleChanged;
            SizeChanged += Main_SizeChanged;
            NotifySystem.RegisterClick(TaskbarIconClickHandler);
            Core.MainIsVisible = true;
            _hotkeyHelper = new HotkeyHelper(Handle);
            _playKey = _hotkeyHelper.RegisterHotkey(Keys.F5, KeyModifiers.Alt);
            _playKey1 = _hotkeyHelper.RegisterHotkey(Keys.Play, KeyModifiers.None);
            _playKey2 = _hotkeyHelper.RegisterHotkey(Keys.Pause, KeyModifiers.None);
            _prevKey = _hotkeyHelper.RegisterHotkey(Keys.Left, KeyModifiers.Alt);
            _prevKey1 = _hotkeyHelper.RegisterHotkey(Keys.MediaPreviousTrack, KeyModifiers.None);
            _nextKey = _hotkeyHelper.RegisterHotkey(Keys.Right, KeyModifiers.Alt);
            _nextKey1 = _hotkeyHelper.RegisterHotkey(Keys.MediaNextTrack, KeyModifiers.None);
            _hotkeyHelper.OnHotkey += OnHotkey;

            Main_Main_Display.ResumeLayout();
        }

7. Example

Project: OutlookGnuPG
Source File: Settings.cs
View license
private void PopulatePrivateKeys(bool gotGnu)
    {
      IList<GnuKey> keys = gotGnu ? Globals.OutlookGnuPG.GetPrivateKeys(GnuPgPath) : new List<GnuKey>();

      KeyBox.DataSource = keys;
      KeyBox.DisplayMember = "KeyDisplay";
      KeyBox.ValueMember = "Key";

      if (KeyBox.Items.Count <= 0)
        return;

      KeyBox.SelectedValue = DefaultKey;

      // Enlarge dialog to fit the longest key
      using (Graphics g = CreateGraphics())
      {
        int maxSize = Width;
        foreach (GnuKey key in keys)
        {
          int textWidth = (int)g.MeasureString(key.KeyDisplay, KeyBox.Font).Width + 50 + 27;
          if (textWidth > maxSize)
            maxSize = textWidth;
        }
        Width = maxSize;
        CenterToScreen();
      }
    }

8. Example

Project: subtitleedit
Source File: Main.cs
View license
private void Main_Load(object sender, EventArgs e)
        {
            splitContainer1.Panel1MinSi/n ..... /n //View Source file for more details /n }

9. Example

Project: OutlookGnuPG
Source File: Passphrase.cs
View license
private void Passphrase_Load(object sender, EventArgs e)
    {
      EmptyPrivateKeyField(KeyBox);

      IList<GnuKey> keys = Globals.OutlookGnuPG.GetPrivateKeys();
      KeyBox.DataSource = keys;
      KeyBox.DisplayMember = "KeyDisplay";
      KeyBox.ValueMember = "Key";

      if (KeyBox.Items.Count <= 0)
      {
        // No keys available, no use in showing this dialog at all
        Hide();
        return;
      }

      // Enlarge dialog to fit the longest key
      using (Graphics g = CreateGraphics())
      {
        int maxSize = Width;
        foreach (GnuKey key in keys)
        {
          int textWidth = (int)g.MeasureString(key.KeyDisplay, KeyBox.Font).Width + 50;
          if (textWidth > maxSize)
            maxSize = textWidth;
        }
        Width = maxSize;
        CenterToScreen();
      }

      KeyBox.SelectedValue = _defaultKey;
    }

10. Example

Project: OutlookGnuPG
Source File: Recipient.cs
View license
private void OldPassphrase_Load(object sender, EventArgs e)
    {
      IList<GnuKey> keys = G/n ..... /n //View Source file for more details /n }

11. Example

Project: bvcms
Source File: Login.cs
View license
private void onLoginLoad(object sender, EventArgs e)
        {
            this.CenterToScreen();
            this.Location = new Point(this.Location.X, this.Location.Y / 2);

            updateViews();

            //if (Program.settings.popupForVersion < 1) {
            //	MessageBox.Show("The Check-In program has been updated,\nplease verify the following settings:\n\n" +
            //		"Login Page\n\n- Server name (e.g. <yourchurch>.tpsdb.com)\n- Username\n- Password\n- Printer\n- Advanced Page Size (Optional)\n\n" +
            //		"Settings Page\n\n- Campus\n- Early Checkin Hours\n- Late Checkin Minutes\n- Checkboxes at the bottom", "New Version", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

            //	Program.settings.setPopupForVersion(1);
            //}

            keyboard.Show();
            attachKeyboard();

            this.Focus();

            URL.Text = Program.settings.subdomain.Replace(".tpsdb.com", "").Replace(".bvcms.com", "");
            username.Text = Program.settings.user;

            if (username.Text.Length > 0)
            {
                current = password;
                this.ActiveControl = password;
            }
            else
            {
                current = URL;
                this.ActiveControl = URL;
            }
        }

12. Example

Project: bvcms
Source File: LoginSettings.cs
View license
private void onLoginSettingsLoad(object sender, EventArgs e)
        {
            this.CenterToScre/n ..... /n //View Source file for more details /n }

13. Example

Project: OutlookGnuPG
Source File: Recipient.cs
View license
private void Passphrase_Load(object sender, EventArgs e)
    {
      IList<GnuKey> keys = Glob/n ..... /n //View Source file for more details /n }

14. Example

Project: Mist
Source File: MetroForm.cs
View license
protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (DesignMode) return;

            switch (StartPosition)
            {
                case FormStartPosition.CenterParent:
                    CenterToParent();
                    break;
                case FormStartPosition.CenterScreen:
                    if (IsMdiChild)
                    {
                        CenterToParent(); 
                    }
                    else 
                    {
                        CenterToScreen();
                    }
                    break;
            }

            RemoveCloseButton();
        
            if (ControlBox)
            {
                AddWindowButton(WindowButtons.Close);

                if (MaximizeBox)
                    AddWindowButton(WindowButtons.Maximize);

                if (MinimizeBox)
                    AddWindowButton(WindowButtons.Minimize);

                UpdateWindowButtonPosition();
            }

            CreateShadow();
        }

15. Example

Project: winauth
Source File: MetroForm.cs
View license
protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (DesignMode) return;

            switch (StartPosition)
            {
                case FormStartPosition.CenterParent:
                    CenterToParent();
                    break;
                case FormStartPosition.CenterScreen:
                    if (IsMdiChild)
                    {
                        CenterToParent(); 
                    }
                    else 
                    {
                        CenterToScreen();
                    }
                    break;
            }

            RemoveCloseButton();
        
            if (ControlBox)
            {
                AddWindowButton(WindowButtons.Close);

                if (MaximizeBox)
                    AddWindowButton(WindowButtons.Maximize);

                if (MinimizeBox)
                    AddWindowButton(WindowButtons.Minimize);

                UpdateWindowButtonPosition();
            }

            CreateShadow();
        }

16. Example

Project: AnotherSc2Hack
Source File: NewMainHandler.cs
View license
private void ControlsFill()
        {
            //Application / Global
            ntxtMemoryRefresh.Number = PSettings.PreferenceAll.Global.DataRefresh;
            ntxtGraphicsRefresh.Number = PSettings.PreferenceAll.Global.DrawingRefresh;
            ktxtReposition.Text = PSettings.PreferenceAll.Global.ChangeSizeAndPosition.ToString();
            aChBxOnlyDrawInForeground.Checked = PSettings.PreferenceAll.Global.DrawOnlyInForeground;
            aChBxShowWebContent.Checked = PSettings.PreferenceAll.Global.ApplicationShowWebContent;

            if (!PSettings.PreferenceAll.Global.ApplicationSize.Equals(new Size(0, 0)))
                Size = PSettings.PreferenceAll.Global.ApplicationSize;

            else
                Size = new Size(1196, 630);

            CenterToScreen();

            InitializeLanguageFiles();
            InitializeResources();
            InitializeIncome();
            InitializeApm();
            InitializeArmy();
            InitializeWorker();
            InitializeMaphack();
            InitializeUnittab();
            InitializeProductiontab();
            InitializeVarious();
        }