好了··上次讲到···childwindows 干啥的?~》
这次就看看··吧··
如果你之前下载了····PicBtn 这个文件,···那就应该会有以下的图片
接着就是他的XAML布局
<controls:ChilDWindow x:Class="SilverlightmusicHit.ChildMusiCMSg" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:controls="clr-namespace:System.windows.Controls;assembly=System.windows.Controls" WIDth="400" Height="300" Opacity="0.9" xmlns:datainput="clr-namespace:System.windows.Controls;assembly=System.windows.Controls.Data.input"> <GrID x:name="LayoutRoot" margin="2" LostFocus="LayoutRoot_LostFocus"> <GrID.RowDeFinitions> <RowDeFinition Height="150"/> <RowDeFinition Height="50"/> <RowDeFinition Height="auto" /> </GrID.RowDeFinitions> <button x:name="btnStart" Content="START" WIDth="126" Height="63" HorizontalAlignment="Right" margin="0,125,-28" GrID.Row="2" Opacity="0.5" MouseLeave="btn_MouseLeave" MouseMove="btn_MouseMove" Click="btnStart_Click" /> <Image Height="150" WIDth="150" HorizontalAlignment="left" margin="0,0" name="imgMusic" Stretch="Fill" VerticalAlignment="top" GrID.Row="0" Source="../Image/PicBtn/musiCMSg.png"/> <TextBlock Height="140" HorizontalAlignment="left" margin="150,10,0" name="txtMusicTitle" VerticalAlignment="top" WIDth="230" FontSize="32" Text="txt" textwrapPing="Wrap" /> </GrID></controls:ChilDWindow>
- = 怎么越讲越少,····怎么说呢···其实这些布局···应该还看得懂吧。
进入···ChildMusiCMSg.cs才是重点
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;using System.Threading;namespace SilverlightmusicHit{ public partial class ChildMusiCMSg : ChilDWindow { #region 变量 /// <summary> /// 音乐信息索引 /// </summary> private static int _musicIndex = 0; #endregion public ChildMusiCMSg(int musicIndex) { InitializeComponent(); _musicIndex = musicIndex; //读取音乐信息 txtMusicTitle.Text = Common._MusicValue[_musicIndex].Musicname; } /// <summary> /// 鼠标移过按钮高亮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private voID btn_MouseMove(object sender,MouseEventArgs e) { ((button)sender).Opacity = 1; } /// <summary> /// 鼠标离开按钮恢复 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private voID btn_MouseLeave(object sender,MouseEventArgs e) { ((button)sender).Opacity = 0.5; } private voID btnStart_Click(object sender,RoutedEventArgs e) { ((App)(Application.Current)).RedirectTo(new Game(_musicIndex)); this.DialogResult = true; } private voID LayoutRoot_LostFocus(object sender,RoutedEventArgs e) { this.DialogResult = true; } }}
噢··还有错误,···,嗯,还要创建一个新的窗体,··Game , 进入游戏了··呵呵··· - = 不过下一章才讲~
好了··就这样吧···
name:5+x
参考文章与书籍:
WPF葵花宝典
总结以上是内存溢出为你收集整理的silverlight乐动魔方 实战八全部内容,希望文章能够帮你解决silverlight乐动魔方 实战八所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)