2012-09-04 47 views
1

我需要一个Windows窗体应用程序的UI控件。我不知道这个UI的名称是什么,但我可以描述我想要的:我可以在窗体上有一个按钮,当我将鼠标悬停在它上面时,我正在查找的CONTROL在我的窗体旁边打开与动画,我想在该控件中添加一些按钮。这是什么控制? RAD可以使用哪种控制方式?我非常感谢你的帮助。我需要一个UI控件.net窗体窗体应用程序

回答

1

你需要的是另一个Form与一些定制(也许删除顶部的控制框,例如关闭,最大化和最小化)。您可以在您的按钮MouseHover事件中打开此表单。 喜欢的东西:

private void MyButton_MouseHover(object sender, EventArgs e) 
{ 
//Assume that you made this form in designer 
var cutomForm = new CustomForm(); 
//Set the opening location somewhere on the right side of main form, you can change it ofc 
cutomForm.Location = new Point(this.Location.X + this.Width, this.Height/2); 
//Probably topmost is needed 
cutromForm.TopMust = true; 
customForm.Show(); 
} 

至于动画,您可以搜索动画上google.Or winformws看这里和那里,是这样的:WinForms animation

关于你的另一个问题

如果你希望新的打开的表单随着你的移动而移动,那么你需要做一些改变。首先,你需要有新的形式,在你的代码字段(然后按钮悬停也应该改变):

private CustomForm _customForm; 

    private void MyButton_MouseHover(object sender, EventArgs e) 
    { 
     //Check if customForm was perviously opened or not 
     if(_customForm != null) 
      return; 

     //Assume that you made this form in designer 
     _customForm= new CustomForm(); 
     //Set the opening location somewhere on the right side of main form, you can change it ofc 
     _customForm.Location = new Point(this.Location.X + this.Width, this.Height/2); 
     //Probably topmost is needed 
     _customForm.TopMust = true; 

     //Delegate to make form null on close 
     _customForm.FormClosed += delegate { _customForm = null;}; 
     _customForm.Show(); 
    } 

为了保持双方的形式一起移动,你需要处理,在Move事件的您主要形式,如:

private void Form1_Move(object sender, EventArgs e) 
{ 
     if(_customForm != null) 
     { 
      //Not sure if this gonna work as you want but you got the idea I guess 
      _customForm.Location = new Point(this.Location.X + this.Width, this.Height/2); 

     } 
} 
+0

非常感谢您的良好回答,我希望开放表格能够坚持到父母的右上角,我该如何做到这一点?我的意思是,即使父母移动,我想打开的表格坚持父母 – Karamafrooz

+0

@Karamafrooz NP,检查更新希望它有帮助。 –

+0

thx很多!你的answear很棒:)) – Karamafrooz

相关问题