vncSharp.RemoteDesktop 获取服务器屏幕尺寸 - 详细指南
要获取服务器屏幕大小,您可以使用 vncSharp.RemoteDesktop 库中的 GetDesktopSize() 方法。以下是示例代码:\n\ncsharp\nusing vncSharp;\n\nnamespace RemoteDesktopExample\n{\n class Program\n {\n static void Main(string[] args)\n {\n // 创建一个 RemoteDesktop 对象\n RemoteDesktop client = new RemoteDesktop();\n\n // 连接到服务器\n client.Connect("127.0.0.1", 5900);\n\n // 获取服务器屏幕大小\n int screenWidth = client.GetDesktopSize().Width;\n int screenHeight = client.GetDesktopSize().Height;\n\n // 打印屏幕大小\n Console.WriteLine("Screen Width: " + screenWidth);\n Console.WriteLine("Screen Height: " + screenHeight);\n\n // 断开与服务器的连接\n client.Disconnect();\n }\n }\n}\n\n\n请注意,您需要使用正确的服务器 IP 地址和端口号来连接到服务器。在上面的示例中,我使用的是本地主机 (127.0.0.1) 和默认 VNC 端口 (5900)。
原文地址: https://www.cveoy.top/t/topic/pZlv 著作权归作者所有。请勿转载和采集!