大佬教程收集整理的这篇文章主要介绍了Silverlight4入门之rectangle控件(四),大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
<UserControl x:Class="FirstSilverlightApplication.MainPage" xmlns="http://scheR_543_11845@as.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://scheR_543_11845@as.microsoft.com/winfx/2006/xaml" xmlns:d="http://scheR_543_11845@as.microsoft.com/expression/blend/2008" xmlns:mc="http://scheR_543_11845@as.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="400" xmlns:sdk="http://scheR_543_11845@as.microsoft.com/winfx/2006/xaml/presentation/sdk"> <Grid x:Name="LayoutRoot" BACkground="White"> <Rectangle Height="138" HorizontalAlignment="Left" Margin="0,0" Name="rectangle1" stroke="Black" strokeThickness="1" VerticalAlignment="Top" Width="258" Fill="#FFF27979" MouseMove="rectangle1_MouseMove" MouseRightButtonDown="rectangle1_MouseRightButtonDown" MouseRightButtonUp="rectangle1_MouseRightButtonUp" MouseWheel="rectangle1_MouseWheel" /> <TextBlock Height="23" HorizontalAlignment="Left" Margin="12,177,0" Name="textBlock1" Text="TextBlock" VerticalAlignment="Top" Width="258" /> <TextBlock Height="23" HorizontalAlignment="Left" Margin="12,217,0" Name="textBlock2" Text="TextBlock" VerticalAlignment="Top" Width="258" /> </Grid> </UserControl>@H_696_19@using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; namespace FirstSilverlightApplication { public partial class MainPage : UserControl { public MainPage() { InitializeComponent(); } private void rectangle1_MouseMove(object sender,MouseEventArgs E) { textBlock1.Text = e.GetPosition(this).X.ToString(); textBlock2.Text = e.GetPosition(this).Y.ToString(); } private void rectangle1_MouseRightButtonDown(object sender,MouseButtonEventArgs E) { rectangle1.Fill = new SolidColorBrush(Colors.Yellow); e.Handled = true; } private void rectangle1_MouseRightButtonUp(object sender,MouseButtonEventArgs E) { rectangle1.Fill = new SolidColorBrush(Colors.Green); } private void rectangle1_MouseWheel(object sender,MouseWheelEventArgs E) { if (e.Delta > 0) { textBlock1.Text = "Up"; } else { textBlock1.Text = "Down"; } } } } @H_696_19@
以上是大佬教程为你收集整理的Silverlight4入门之rectangle控件(四)全部内容,希望文章能够帮你解决Silverlight4入门之rectangle控件(四)所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。