One day, a brother asked how to do this in WPF.FormWhen you write the followingCodeAfter, I realized that it was weird ..
<Window X: class = "wpfwindowtransform. window2"
Xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Xmlns: x = "http://schemas.microsoft.com/winfx/2006/xaml"
Title = "window2" Height = "300" width = "300" X: Name = "windows2" background = "yellow" rendertransformorigin = "0.5, 0.5"
Windowstartuplocation = "centerscreen" resizemode = "noresize" showintaskbar = "false">
<Window. rendertransform>
<Transformgroup>
<Scaletransform scalex = "1" scaley = "1"/>
<Skewtransform anglex = "0" angley = "0"/>
<Rotatetransform angle = "0"/>
<Translatetransform x = "0" Y = "0"/>
</Transformgroup>
</Window. rendertransform>
<Window. Resources>
<Storyboard X: Key = "scalexstoryboard">
<Doubleanimationusingkeyframes repeatbehavior = "forever" begintime = "00:00:00" storyboard. targetname = "windows2"
Storyboard. targetproperty = "(uielement. rendertransform). (transformgroup. Children) [2]. (rotatetransform. Angle)">
<Splinedoublekeyframe keytime = "00:00:03" value = "360"> </splinedoublekeyframe>
</Doubleanimationusingkeyframes>
<Doubleanimationusingkeyframes begintime = "00:00:00" storyboard. targetname = "windows2"
Storyboard. targetproperty = "(uielement. rendertransform). (transformgroup. Children) [0]. (scaletransform. scaley)">
<Splinedoublekeyframe keytime = "00:00:03" value = "0.1"> </splinedoublekeyframe>
</Doubleanimationusingkeyframes>
<Doubleanimationusingkeyframes begintime = "00:00:00" storyboard. targetname = "windows2"
Storyboard. targetproperty = "(uielement. rendertransform). (transformgroup. Children) [0]. (scaletransform. scalex)">
<Splinedoublekeyframe keytime = "00:00:03" value = "0.1"> </splinedoublekeyframe>
</Doubleanimationusingkeyframes>
</Storyboard>
</Window. Resources>
<Window. triggers>
<Eventtrigger routedevent = "frameworkelement. Loaded">
<Beginstoryboard storyboard = "{staticresource scalexstoryboard}">
</Beginstoryboard>
</Eventtrigger>
</Window. triggers>
<Grid background = "red" width = "200" Height = "200">
</GRID>
</WINDOW>
Execute thisProgramIt can be seen that the final rotation effect does not include the outside part of the window, that is, the title bar and button on the window, and does not follow the rotation .. The rotation is only the content part of the window form !..........
Of course, if windowstyle = "NONE" allowstransparency = "true" is added, there will be no black background behind it, but there will be no buttons such as close of the form ....