0

我正在寻找一种在单击按钮时调整窗口大小的方法,原因是我希望用户认为窗口正在变成另一个窗口。

每当我在 VSM 中调整窗口大小时,它只会显示一个异常和堆栈跟踪导致一堆错误,那么有没有办法完成我想要做的事情?

谢谢

4

1 回答 1

0

如果你有混合,去试试情节提要,在那里你可以动画窗口调整大小。如果你没有,这里有一些帮助你入门

<Window.Resources>
    <Storyboard x:Key="resizeWindow">
        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="{x:Null}" Storyboard.TargetProperty="(FrameworkElement.Width)">
            <SplineDoubleKeyFrame KeyTime="00:00:00" Value="577"/>
            <SplineDoubleKeyFrame KeyTime="00:00:03" Value="25"/>
        </DoubleAnimationUsingKeyFrames>
        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="{x:Null}" Storyboard.TargetProperty="(FrameworkElement.Height)">
            <SplineDoubleKeyFrame KeyTime="00:00:00" Value="469"/>
            <SplineDoubleKeyFrame KeyTime="00:00:03" Value="23.5"/>
        </DoubleAnimationUsingKeyFrames>
    </Storyboard>
</Window.Resources>

这是从起始值 (577, 469) 到结束值 (25,23.5) 的窗口。你可以随时开始这个动画,使用这个:

Storyboard sStory = (Storyboard)this.Resources["resizeWindow"];
sStory.Begin();

希望这可以帮助

于 2010-03-11T10:18:15.600 回答