我需要能够在 C# Windows 窗体应用程序中的 ToolStripStatusLabel 项上设置图标。该项目将显示图像和文本。我以为我可以在这样的项目上使用图标,但我错了。从现有 Icon 对象创建 Image 对象的最佳方法是什么?
预期的代码将类似于:
Image image = new Image(); // Get this image somehow from a pre-existing Icon object
serverInfoToolStripStatusLabel.Text = "Connected to server X";
serverInfoToolStripStatusLabel.Image = image;
(注意:serverInfoToolStripStatusLabel 被声明为 System.Windows.Forms.ToolStripStatusLabel)问候。