wpf - Grow a circle on the center of the screen -
i want have circle grows middle of screen 500px in diameter. i'm going have circle act window application (so user going drag around normal window).
so far can have circle grow height , width of 0 500 in animation on start up. window held in set transparent , sizetocontent ="widthandheight". because containing window hugs circle, circle doesn't grow center of screen anymore, starts center , grows towards right , bottom.
how can have circle grow centre whilst having sizetocontent="widthandheight"?
here's code far:
xaml
<window x:class="mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="mainwindow" windowstyle="none" allowstransparency="true" background="transparent" windowstartuplocation="centerscreen" sizetocontent="widthandheight"> <window.resources> <storyboard x:key="ellipseexpand"> <doubleanimation from="0" to="500" duration="0:0:5" storyboard.targetname="mycircle" storyboard.targetproperty="width"/> <doubleanimation from="0" to="500" duration="0:0:5" storyboard.targetname="mycircle" storyboard.targetproperty="height"/> </storyboard> </window.resources> <ellipse name="mycircle" fill="red" height="0" width="0"/> </window>
code behind
imports system.windows.media.animation class mainwindow public sub windowloaded() handles me.loaded dim ellipseexpand storyboard = findresource("ellipseexpand") ellipseexpand.begin() end sub end class
i instead used workaround:
i housed ellipse in big transparent window can appear though grows center of screen. if drag ellipse towards top of screen, gets pushed down (because windows os tries fit top of invisible window screen instead of clipping it).
to overcome issue, used thread: how move wpf window negative top value?
Comments
Post a Comment