cleaning redundant blocks

This commit is contained in:
Dimitrij
2022-05-14 20:39:00 +01:00
parent ace62c07be
commit dfb1d34b8a
4 changed files with 29 additions and 43 deletions

View File

@@ -30,6 +30,7 @@ namespace mRemoteNG.App
CatchAllUnhandledExceptions();
System.Windows.Forms.Application.EnableVisualStyles();
System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false);
var frmSplashScreen = FrmSplashScreenNew.GetInstance();
Screen targetScreen = (Screen.AllScreens.Length > 1) ? Screen.AllScreens[1] : Screen.AllScreens[0];
@@ -37,18 +38,12 @@ namespace mRemoteNG.App
Rectangle viewport = targetScreen.WorkingArea;
frmSplashScreen.Top = viewport.Top;
frmSplashScreen.Left = viewport.Left;
//mainWindow.Show();
Screen[] screens = Screen.AllScreens;
//if (screens.Length > 1)
//{
// normaly it should be screens[1] however due DPI apply 1 size "same" as default with 100%
frmSplashScreen.Left = viewport.Left + (targetScreen.Bounds.Size.Width / 2) - (frmSplashScreen.Width / 2);
frmSplashScreen.Top = viewport.Top + (targetScreen.Bounds.Size.Height / 2) - (frmSplashScreen.Height / 2);
//frmSplashScreen.Top = 50;
//}
//frmSplashScreen.Show();
frmSplashScreen.Show();
System.Windows.Forms.Application.Run(FrmMain.Default);
}

View File

@@ -1,19 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Forms;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Drawing.Text;
using System.Drawing;
using mRemoteNG.App.Info;
namespace mRemoteNG.UI.Forms

View File

@@ -39,6 +39,7 @@
this.viewMenu = new mRemoteNG.UI.Menu.ViewMenu();
this.toolsMenu = new mRemoteNG.UI.Menu.ToolsMenu();
this.helpMenu = new mRemoteNG.UI.Menu.HelpMenu();
this.modeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.mMenSep3 = new System.Windows.Forms.ToolStripSeparator();
this.tsContainer = new System.Windows.Forms.ToolStripContainer();
this._quickConnectToolStrip = new mRemoteNG.UI.Controls.QuickConnectToolStrip();
@@ -81,7 +82,7 @@
this.msMain.Location = new System.Drawing.Point(3, 0);
this.msMain.Name = "msMain";
this.msMain.Padding = new System.Windows.Forms.Padding(0, 0, 1, 0);
this.msMain.Size = new System.Drawing.Size(309, 25);
this.msMain.Size = new System.Drawing.Size(151, 25);
this.msMain.Stretch = false;
this.msMain.TabIndex = 0;
this.msMain.Text = "Main Toolbar";
@@ -124,6 +125,11 @@
this.helpMenu.Text = "&Help";
this.helpMenu.TextDirection = System.Windows.Forms.ToolStripTextDirection.Horizontal;
//
// modeToolStripMenuItem
//
this.modeToolStripMenuItem.Name = "modeToolStripMenuItem";
this.modeToolStripMenuItem.Size = new System.Drawing.Size(12, 25);
//
// mMenSep3
//
this.mMenSep3.Name = "mMenSep3";
@@ -188,6 +194,15 @@
// vsToolStripExtender
//
this.vsToolStripExtender.DefaultRenderer = null;
//
// tsModeAdmin
//
this.tsModeAdmin.Name = "tsModeAdmin";
this.tsModeAdmin.Size = new System.Drawing.Size(32, 19);
//
// tsModeUser
//
this.tsModeUser.Checked = true;
this.tsModeUser.CheckState = System.Windows.Forms.CheckState.Checked;
this.tsModeUser.Name = "tsModeUser";
this.tsModeUser.Size = new System.Drawing.Size(180, 22);
@@ -206,7 +221,7 @@
this.MinimumSize = new System.Drawing.Size(400, 400);
this.Name = "FrmMain";
this.Opacity = 0D;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = " ";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmMain_FormClosing);
this.Load += new System.EventHandler(this.FrmMain_Load);

View File

@@ -64,7 +64,14 @@ namespace mRemoteNG.UI.Forms
{
_showFullPathInTitle = Properties.OptionsAppearancePage.Default.ShowCompleteConsPathInTitle;
InitializeComponent();
DPI_Per_Monitor.TryEnableDPIAware(this, SetUserFonts);
Screen targetScreen = (Screen.AllScreens.Length > 1) ? Screen.AllScreens[1] : Screen.AllScreens[0];
Rectangle viewport = targetScreen.WorkingArea;
// normaly it should be screens[1] however due DPI apply 1 size "same" as default with 100%
this.Left = viewport.Left + (targetScreen.Bounds.Size.Width / 2) - (this.Width / 2);
this.Top = viewport.Top + (targetScreen.Bounds.Size.Height / 2) - (this.Height / 2);
Fullscreen = new FullscreenHandler(this);
//Theming support
@@ -74,23 +81,7 @@ namespace mRemoteNG.UI.Forms
_advancedWindowMenu = new AdvancedWindowMenu(this);
}
void SetUserFonts(float scaleFactorX, float scaleFactorY)
{
//this.Width = (int)Math.Ceiling(this.Width *scaleFactorX);
//this.Height = (int)Math.Ceiling(this.Height*scaleFactorY);
var OldFont = Font;
Font = new Font(Font.FontFamily, 11f * scaleFactorX, Font.Style, GraphicsUnit.Pixel);
OldFont.Dispose();
//splitContainer1.Size = this.ClientSize; // not strictly important, but stabalize things against rounding errors...
//checkedListBoxSaved.Height = labelAnchorSaved.Top - checkedListBoxSaved.Top; //See note on listboxes
//checkedListBoxCurrent.Height = labelAnchorChecked.Top - checkedListBoxCurrent.Top; //See note on listboxes
Refresh();
}
//protected override void DefWndProc(ref System.Windows.Forms.Message m)
//{
// DPI_Per_Monitor.Check_WM_DPICHANGED_WM_NCCREATE(SetUserFonts, m, this.Handle);
// base.WndProc(ref m);
//}
#region Properties
public FormWindowState PreviousWindowState { get; set; }