
<UserControl x:Class="FirstSilverlightApplication.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/Expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignHeight="300" d:DesignWIDth="400" xmlns:sdk="http://schemas.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>
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"; } } }} 总结 以上是内存溢出为你收集整理的Silverlight4入门之rectangle控件(四)全部内容,希望文章能够帮你解决Silverlight4入门之rectangle控件(四)所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)