private void monitorToolStripMenuItem_Click(object sender, EventArgs e) { TreeNode node = tree_clients.SelectedNode; GodEyeForm godEye = new GodEyeForm(node.Tag as Socket); godEye.OnOff(); godEye.Show(); }
private static GodEyeForm sf;//we can use it to refresh public GodEyeForm(Socket socket) { try { InitializeComponent(); sf = this; clientSocket = socket; byte[] vs = new byte[10]; int count = 0; //Get The Width of screen socket.Send(Encoding.UTF8.GetBytes("W")); count = socket.Receive(vs); SW = int.Parse(Encoding.UTF8.GetString(vs, 0, count)); #if DEBUG Console.WriteLine("Get SW:" + SW.ToString()); #endif //Get The Height of screen socket.Send(Encoding.UTF8.GetBytes("H")); count = socket.Receive(vs); SH = int.Parse(Encoding.UTF8.GetString(vs, 0, count)); #if DEBUG Console.WriteLine("Get SH:" + SH.ToString()); #endif if (!SW.Equals(0) && !SH.Equals(0)) { this.Width = this.pic.Width = SW; this.Height = this.pic.Height = SH; socket.BeginReceive(buffer, 0, buffer.Length, SocketFlags.None, ReceiveCallBack, socket); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void tree_clients_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) { if (e.Node.Name.Equals("root")) { return; } if (e.Button.Equals(MouseButtons.Right)) { //var p = PointToScreen(tree_clients.Location); //int x = MousePosition.X - p.X; //int y = MousePosition.Y - p.Y; return; } TreeNode node = tree_clients.SelectedNode; GodEyeForm godEye = new GodEyeForm(node.Tag as Socket); godEye.OnOff(); godEye.Show(); }