📄 form2.cs
字号:
// \\\|///
// \\ //
// ( @.@ )
//+----------------------oOOo-----(_)-----oOOo------------------------+
//| |
//| Created by stg609 |
//| |
//| 本人博客:http://stg609.cnblogs.com |
//| 由于水平有限,所写代码若有不足,欢迎大家到我博客交流 |
//| |
//| 注:转载请保留此信息 |
//| |
//| Copyright (C) 2008 stg609 |
//| All rights reserved |
//| |
//+-------------------+-ooO------------------Ooo-+--------------------+
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Collections;
using System.Threading;
namespace MatureVoice
{
public partial class Form2 : DevComponents.DotNetBar.Office2007Form
{
public Form2()
{
InitializeComponent();
}
private string strIPAdd;
public string IPAdd
{
get
{
return strIPAdd;
}
}
private void btnCancel_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
this.Close();
}
private Thread threadListUsers;
private void Form2_Load(object sender, EventArgs e)
{
threadListUsers = new Thread(new ThreadStart(ListUsersOnline));
threadListUsers.IsBackground = true;
threadListUsers.Start();
}
private void ListUsersOnline()
{
ArrayList alUsers = ListUsers.GetComputerList();
if (alUsers.Count > 0)
{
for (int i = 0; i < alUsers.Count; i++)
FormWrite((string[])alUsers[i]);
}
else
{
PicVisible(false);
}
}
private void btnSubmit_Click(object sender, EventArgs e)
{
if (treeNode.SelectedNode != null)
{
strIPAdd = treeNode.SelectedNode.Text.Substring(treeNode.SelectedNode.Text.LastIndexOf(':') + 1);
this.DialogResult = DialogResult.OK;
}
else
{
this.DialogResult = DialogResult.Cancel;
}
}
private delegate void FormHandle(string[] strArgu);
private void FormWrite(string[] strTreeNodeText)
{
FormHandle handle = new FormHandle(FormWrite);
if (InvokeRequired)
{
this.Invoke(handle, new object[] { strTreeNodeText });
}
else
{
picLoading.Visible = false;
treeNode.Nodes.Add(strTreeNodeText[1] + ":" + strTreeNodeText[2]);
}
}
private delegate void PicVisibleHandle(bool b);
private void PicVisible(bool bVisible)
{
PicVisibleHandle handle = new PicVisibleHandle(PicVisible);
if (InvokeRequired)
{
this.Invoke(handle, new object[] { bVisible });
}
else
{
picLoading.Visible = bVisible;
}
}
private void treeNode_DoubleClick(object sender, EventArgs e)
{
strIPAdd = treeNode.SelectedNode.Text.Substring(treeNode.SelectedNode.Text.LastIndexOf(':') + 1);
this.DialogResult = DialogResult.OK;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -