日期:2014-05-18  浏览次数:20853 次

c#如何让窗体恢复到用户操作前的大小和位置?
c#如何让窗体恢复到用户操作前的大小和位置?
详细最好,有代码更好
新手自学,请高手指点~谢谢~

------解决方案--------------------
你是要实现啥功能阿,没看太懂。

formload的时候,你可以把窗体初期大小保存到private变量中,想恢复的时候,再把private变量的值赋给窗体。


------解决方案--------------------
窗体加载时记住窗体的大小和位置,要恢复时,,重置就可以了
------解决方案--------------------
//选项的效果
int myx,myy;
myx=this.DesktopLocation.X;
myy=this.DesktopLocation.Y;
if(this.DesktopBounds.Height == 288)
{
Rectangle tempRect = new Rectangle(myx,myy,280,488);
this.DesktopBounds = tempRect;
}
else
{
Rectangle tempRect = new Rectangle(myx,myy,280,288);
this.DesktopBounds = tempRect;
}