silverlight使用定时器右下角定时d窗,模拟信息报警。
代码如下:
<Canvas VerticalAlignment="Bottom" HorizontalAlignment="Right">
<Canvas.Resources>
<Storyboard x:name="storyPopUp">
<DoubleAnimation Duration="0:0:2" From="0" To="-200" Storyboard.Targetname="canvasPopup" Storyboard.TargetProperty="(Canvas.top)" />
</Storyboard>
<Storyboard x:name="storyPopDown">
<DoubleAnimation Duration="0:0:2" From="-200" To="0" Storyboard.Targetname="canvasPopup" Storyboard.TargetProperty="(Canvas.top)" />
</Storyboard>
</Canvas.Resources>
<Canvas VerticalAlignment="Bottom" HorizontalAlignment="Right" x:name="canvasPopup" margin="-200 0 0 0" WIDth="200" Height="200">
<border borderThickness="1,1,1" Background="Azure" HorizontalAlignment="Right" VerticalAlignment="top"
borderBrush="Gold" WIDth="200" Height="200">
<border.Effect>
<DropShadowEffect />
</border.Effect>
<GrID>
<GrID.RowDeFinitions>
<RowDeFinition Height="15" />
<RowDeFinition Height="*" />
</GrID.RowDeFinitions>
<TextBlock Text="学习右下角d窗" FontSize="12" FontWeight="Black" Foreground="Black" GrID.Row="0" />
<border Background="White" margin="0 5 0 0" CornerRadius="5" GrID.Row="1">
<TextBlock Text="d窗显示内容!" margin="3" textwrapPing="Wrap" FontSize="12" WIDth="190" />
</border>
</GrID>
</border>
</Canvas>
</Canvas>
后台代码:
System.windows.Threading.dispatcherTimer gapTimer;
voID initAlarmTimer() { gapTimer = new System.windows.Threading.dispatcherTimer(); gapTimer.Interval = new TimeSpan(0,10); gapTimer.Tick += new EventHandler(gapTimer_Tick); gapTimer.Start(); } voID gapTimer_Tick(object sender,EventArgs e) { popAlarm(); } #region 报警信息 private voID popAlarm() { storyPopUp.Begin(); alarmTitle.Text = "报警类型"; alarmContent.Text = "警情明细" + DateTime.Now.TolongTimeString(); System.windows.Threading.dispatcherTimer timer = new System.windows.Threading.dispatcherTimer(); timer.Interval = new TimeSpan(0,4500); timer.Tick += new EventHandler((sender2,e2) => { storyPopUp.Stop(); storyPopDown.Begin(); timer.Stop(); }); timer.Start(); }
总结以上是内存溢出为你收集整理的silverlight右下角定时d窗,模拟信息报警全部内容,希望文章能够帮你解决silverlight右下角定时d窗,模拟信息报警所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)