c# - 用于调整大小形式的扩展器(如小工具) [英] c # - expander for resize form ( like gadgets)

查看:108
本文介绍了c# - 用于调整大小形式的扩展器(如小工具)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好家伙



在GADGETS菜单中你看到一个扩展器用于显示/隐藏详细信息。当点击显示详细信息表单时,使用动画缓慢调整大小,当我点击隐藏再次展开窗体调整大小到第一个尺寸。



看小工具。我需要帮助和示例源代码

解决方案

您可以使用 Control.Dock属性 [ ^ ]和 Control.Anchor Property [ ^ ]管理最小化,最大化以及重新调整控件大小。



看看那里< a href =http://msdn.microsoft.com/en-us/library/ms229606(v=vs.110).aspx>如何:调整Windows窗体大小 [ ^ ]了解如何调整代码以调整大小表格。


使用计时器:1/10秒,或者可能是1/20。

具有班级目标值和Delta。在启动计时器之前设置它们。

如果计时器Tick事件,检查delta:如果它是正数,你想向下移动,负向上移动。零,停止计时器。

将增量添加到高度,并检查目标:如果您还没有(这取决于上面的上/下,请记住允许超调并且不要使用==,您需要< =或> =)然后将新值设置为表单高度。

如果完成,则将表单高度设置为目标高度,将Delta归零,然后停止计时器。


我在c sharp中的新内容:(你能做一个项目吗?



我使用WPF应用程序..


hello guy

in GADGETS menu you see a expander for a show/Hide Details.and when click show details form resize slowly with animate and when i click hide expander again Form resize to first size.

see in gadgets. i need help and example source code

解决方案

You can use Control.Dock Property[^] and Control.Anchor Property[^] to manage minimizing, maximizing as well as re sizing your control.

Take a look there How to: Resize Windows Forms[^] to learn how to code to resize the form.


Use a Timer: 1/10th second, or maybe 1/20th should do.
Have a class level Target value, and a Delta. Set them before you start the timer.
If the timer Tick event, check the delta: if it's positive, you want to move down, negative move up. Zero, stop the timer.
Add the delta to the Height, and check against the target: If you aren't there yet (which depends on the up / down from above, remember to allow for overshoot and don't use ==, you need <= or >=) then set the new value into the Form Height.
If you are done, then set the Form Height to the Target height, zero the Delta, and stop the timer.


im new in c sharp :( can you make a project ?

I use WPF application..


这篇关于c# - 用于调整大小形式的扩展器(如小工具)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆