using System.Net;
System.Net.IPHostEntry IPHost = System.Net.Dns.GetHostEntry(Environment.MachineName); if (IPHost.AddressList.Length > 0) { MessageBox.Show(IPHost.AddressList[0].ToString(), "電腦本機IP"); }