在运行时模式下,在设计模式下显示控件的选项卡 [英] Show control's tabs like in the design mode during the runtime mode
问题描述
亲爱的,< o:p>< / o:p>
我正在编写一些代码,需要在运行时模式下为用户提供与设计模式相同的行为,我的意思是,我想启用控件选项卡(当我们出现时,会出现八个小的
方块在运行时模式下,在设计模式期间单击,例如在按钮中,用户应该能够调整大小并移动,但首先我想看到控件上的小方块。< o:p> ;< / o:p>
我已经研究过控制类属性,但我没有找到哪种方法适合这种方法......< o:p>< / o:p>
对此有任何建议,非常欢迎!
< o:p>< / o:p>
推荐答案
您可以使用控件的MouseMove事件处理程序实现此目的。请查看以下代码,根据鼠标移动按下鼠标左键后调整按钮的大小。在顶部"初始化"使用System.Windows.Forms;"
希望这可以帮助您。
You can use the control's MouseMove event handler t achieve this. Please look into the below code, it resizes the button after pressing your mouse's left button based on your mouse movement. Initialize this at the top "using System.Windows.Forms;" Hope this helps you.
using System.Windows.Forms;
private void button1_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left) //For resize
{
button1.Width = e.X;
button1.Height = e.Y;
}
}
这篇关于在运行时模式下,在设计模式下显示控件的选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!