private void tabControl1_MouseClick(object sender, MouseEventArgs e) { TabControl tc = (TabControl)sender; Point p = e.Location; int _tabWidth = 0; _tabWidth = this.tabControl1.GetTabRect(tc.SelectedIndex).Width - (mImgHitArea.X); Rectangle r = this.tabControl1.GetTabRect(tc.SelectedIndex); r.Offset(_tabWidth, mImgHitArea.Y); r.Width = 16; r.Height = 16; if (r.Contains(p)) { TabPage TabP = (TabPage)tc.TabPages[tc.SelectedIndex]; if (TabP.Controls[0] is LHJ.ServerInfoMonitor.RDP) { LHJ.ServerInfoMonitor.RDP _RDP = TabP.Controls[0] as LHJ.ServerInfoMonitor.RDP; _RDP.Disconnect(); } tc.TabPages.Remove(TabP); } }
private Point GetDesktopSize(LHJ.ServerInfoMonitor.RDP aRDP, string aDesktopSize, bool aIsFullScreen) { int width; int height; if (aDesktopSize.Equals(string.Empty)) { if (aIsFullScreen) { width = Screen.FromControl((Control)this).Bounds.Width; height = Screen.FromControl((Control)this).Bounds.Height; } else { width = aRDP.Width; height = aRDP.Height; } } else if (aDesktopSize.Contains("X")) { string[] strArray = aDesktopSize.Split("X".ToCharArray()); width = int.Parse(strArray[0]); height = int.Parse(strArray[1]); } else { string str = aDesktopSize; if (!(str == "FullScreen")) { if (str == "CurrentViewSize") { width = aRDP.Width; height = aRDP.Height; } else { width = aRDP.Width; height = aRDP.Height; } } else { Rectangle bounds = Screen.FromControl((Control)this).Bounds; width = bounds.Width; bounds = Screen.FromControl((Control)this).Bounds; height = bounds.Height; } } return(new Point(width, height)); }
private void StartRDP(ServerListParam aParam) { TabPage newPage = new TabPage(); LHJ.ServerInfoMonitor.RDP _RDP = new LHJ.ServerInfoMonitor.RDP(); newPage.Text = aParam.A_서버명칭 + " "; newPage.Controls.Add((Control)_RDP); this.tabControl1.TabPages.Add(newPage); this.tabControl1.SelectedTab = newPage; _RDP.BringToFront(); _RDP.Server = aParam.B_IP주소; _RDP.UserName = aParam.C_사용자이름; _RDP.ClearTextPassword = aParam.D_비밀번호; _RDP.RedirectDrives = aParam.B_RedirectDrives; _RDP.RedirectClipboard = aParam.C_RedirectClipboard; _RDP.RedirectPrinters = aParam.D_RedirectPrinters; _RDP.SmartSizing = aParam.E_SmartSizing; _RDP.FullScreen = aParam.A_FullScreen; _RDP.ContainerHandledFullScreen = false; _RDP.ConnectionBarShowMinimizeButton = false; Point desktopSize = this.GetDesktopSize(_RDP, aParam.F_DesktopSize, aParam.A_FullScreen); _RDP.DesktopWidth = desktopSize.X; _RDP.DesktopHeight = desktopSize.Y; _RDP.ConnectingText = string.Format("연결중...{0}[{1}]", aParam.A_서버명칭, aParam.B_IP주소); _RDP.DisconnectedText = string.Format("연결해제...{0}[{1}]", aParam.A_서버명칭, aParam.B_IP주소); if (aParam.G_ColorDepth.Contains("8")) { _RDP.ColorDepth = 8; } else if (aParam.G_ColorDepth.Contains("16")) { _RDP.ColorDepth = 16; } else if (aParam.G_ColorDepth.Contains("24")) { _RDP.ColorDepth = 24; } else if (aParam.G_ColorDepth.Contains("32")) { _RDP.ColorDepth = 32; } _RDP.Connect(); }