如何将ToolStripMenuItem与Picturebox连接? [英] How do I connect a ToolStripMenuItem with a Picturebox?
问题描述
有三个ToolStripMenuItem,我需要将这三个链接到Picturebox。当程序运行并将指针悬停在每个ToolStripMenuItem上时,图片框中会出现另一个图像。我不知道该怎么做,请帮忙!
There are three ToolStripMenuItem's, I need to link these three to a Picturebox. When the program is running and you hover the pointer over each ToolStripMenuItem, a different image appears in the picturebox. I have no idea how to do this, please help!
推荐答案
在设计器中创建ToolStrip并添加按钮后,将会有每个按钮的代码对象根据其名称(例如ToolStripButton1)。
Once you've created the ToolStrip in the designer and added the buttons, there will be code objects for each button according to their names (eg ToolStripButton1).
在代码中,您可以为ToolStripButton.MouseHover事件添加处理程序,在该事件处理程序代码中,您可以设置按钮的图像财产到你需要的任何东西。
In code you can add a handler to the ToolStripButton.MouseHover event and in that event handler code you can set the button's Image property to whatever you need.
这篇关于如何将ToolStripMenuItem与Picturebox连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!