---
title: ".Net Mirco Framework 2007技术大会"
author: "mmdev"
date: "2007-09-18T21:13:00Z"
tags: []
slug: "net-mirco-framework-2007"
draft: false
lastmod: "2012-08-04T21:34:28Z"
id: 1620957
url: "https://mmdev.iteye.com/blog/1620957"
---

.Net Mirco Framework 2007技术大会

2006年在《程序员》杂志上通过看马宁的专栏文章，第一次知道了.Net MF。一年后的今天终于近距离地接触了.Net Mirco Frmaework，对MF有了一定的感性认识。

最近公司很多项目都有大量嵌入式设备使用，由于WinCE系统相对较大，对硬件平台要求过高，所以对.Net MF一直比较关注。今天总算大开眼界了。

![](http://p.blog.csdn.net/images/p_blog_csdn_net/yefanqiu/MF07091801.jpg)

微软公司的Colin Miller和Digi公司的John Leier在上午的演讲拉开了.Net MF序幕，针对嵌入式领域，一个从软件角度进行阐述，另一个从硬件平台角度进行呼应，一软一硬，二者强强联合，恐怕未来嵌入式智能设备一半以上的项目开发要被其收入囊中了。下午的中文演讲给人感觉有些干瘪，两三个演讲，平均短短十几分钟就草草收场。后来微软公司杜伟的演讲，从VS2005一行行难以看清的代码，到一个个令人惊艳的样例把MF开发技术推向最前台。

![](http://p.blog.csdn.net/images/p_blog_csdn_net/yefanqiu/MF07091802.jpg)

Digi公司很是有魄力，免费送出15套开发套件（5个作为回答问题的奖品，10个抽奖），自己即没有回答问题的勇气，也没有好的运气，只好剩下羡慕的份了。

最后为每个人送出的1G优盘（类似微软今年MVP大礼包中的优盘）很有分量，不仅是1G的容量，并且里面竟然把所有的幻灯片拷贝其中，更没有想到的是，MF 的SDK也在里面，真棒！

回到家迫不及待装了一份MF SDK（MicroFrameworkSDK.MSI 区区只有5998 kb，强！），有模拟器，也有示例。

![](http://p.blog.csdn.net/images/p_blog_csdn_net/yefanqiu/MF07091806.jpg)

其中几个示例不知道为什么编译成功，就是运行失败，对第二示例比较感兴趣，可以绘制图形，并且可以贴图。

![](http://p.blog.csdn.net/images/p_blog_csdn_net/yefanqiu/MF07091803.jpg)

![](http://p.blog.csdn.net/images/p_blog_csdn_net/yefanqiu/MF07091804.jpg)

![](http://p.blog.csdn.net/images/p_blog_csdn_net/yefanqiu/MF07091805.jpg)

相关代码如下：

![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)//Copyright(C)MicrosoftCorporation.Allrightsreserved.  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)usingSystem;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)usingSystem.Collections;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)usingSystem.Threading;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)usingMicrosoft.SPOT;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)usingMicrosoft.SPOT.Input;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)usingMicrosoft.SPOT.Hardware;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)usingMicrosoft.SPOT.Presentation;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)usingMicrosoft.SPOT.Presentation.Media;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)usingMicrosoft.SPOT.Presentation.Controls;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)usingMicrosoft.SPOT.Presentation.Shapes;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)usingPresentationDemo;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)/\*\*///////////////////////////////////////////////////////////////////////////////  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)publicsealedclassMyApp:Application...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)//ThisstaticfieldpreventstheobjectfrombeingGC'd  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)privatestaticGpioButtonInputProviders\_gpioInputProvider;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)publicFontNinaBFont;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)publicFontSmallFont;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)publicBitmapSnowflake;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)privateMyApp()...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)//InitializetheButtons/Pinsdispatcher  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)s\_gpioInputProvider=newGpioButtonInputProvider(this.Dispatcher,null);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)//Loadsomeresources  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)NinaBFont=Resources.GetFont(Resources.FontResources.NinaBFont);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)SmallFont=Resources.GetFont(Resources.FontResources.SmallFont);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)Snowflake=Resources.GetBitmap(Resources.BitmapResources.Snowflake);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)protectedoverridevoidOnStartup(EventArgse)...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)//Createandsettheapplication'smainwindow  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)this.MainWindow=newMainMenuWindow(this);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)base.OnStartup(e);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)publicvoidGoHome()...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)Buttons.Focus(this.MainWindow);//Setfocusbacktothemainwindow  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)publicstaticvoidMain()...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)newMyApp().Run();//Starttheapp'smainwindow  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)/\*\*///////////////////////////////////////////////////////////////////////////////  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)//Thisisthebaseclassofallourwindows;itmakeseverywindowvisible,  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)//setsthewindow'ssizetothefullsizeoftheLCD,andgivethewindowfocus  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)internalclassPresentationWindow:Window...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)protectedMyAppm\_app;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)protectedPresentationWindow(MyAppapp)...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)m\_app=app;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)//MakethewindowvisibleandthesizeoftheLCD  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)this.Visibility=Visibility.Visible;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)this.Width=SystemMetrics.ScreenWidth;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)this.Height=SystemMetrics.ScreenHeight;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)Buttons.Focus(this);//Setfocustothiswindow  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)protectedoverridevoidOnButtonDown(ButtonEventArgse)...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)//RemovethiswindowformtheWindowManager  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)this.Close();  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)//Whenanybuttonispressed,gobacktotheHomepage  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)m\_app.GoHome();  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)/\*\*///////////////////////////////////////////////////////////////////////////////  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)internalsealedclassMainMenuWindow:PresentationWindow...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)privateListBoxm\_listbox;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)publicListBoxMainListBox...{get...{returnm\_listbox;}}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)publicMainMenuWindow(MyAppapp)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif):base(app)...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)ColorinstructionTextColor=ColorUtility.ColorFromRGB(192,192,192);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)ColorbackgroundColor=ColorUtility.ColorFromRGB(26,118,183);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)ColorunselectedItemColor=ColorUtility.ColorFromRGB(192,192,255);//Unselectedlistboxitemcolor  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)ColorselectedItemColor=Colors.White;//Selectedlistboxitemcolor  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)//TheMainwindowcontainsaveritcalStackPanel  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)StackPanelpanel=newStackPanel(Orientation.Vertical);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)this.Child=panel;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)//Thetopchildcontainstextwithinstructions  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)TextFlowtextflow=newTextFlow();  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)textflow.TextAlignment=TextAlignment.Center;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)textflow.Visibility=Visibility.Visible;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)textflow.TextRuns.Add(  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)newTextRun(Resources.GetString(Resources.StringResources.SelectAnItemFromBelow),  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)app.NinaBFont,instructionTextColor));  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)panel.Children.Add(textflow);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)//Addablanklinetothestack  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)panel.Children.Add(textflow=newTextFlow());  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)textflow.TextRuns.Add("",app.NinaBFont,instructionTextColor);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)textflow.Visibility=Visibility.Visible;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)//Thenextchildcontainsalistboxwithoptions  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)m\_listbox=newListBox();  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)//Preparethelistbox  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)Buttons.Focus(m\_listbox);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)panel.Children.Add(m\_listbox);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)this.Background=m\_listbox.Background=newSolidColorBrush(backgroundColor);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)m\_listbox.SelectionChanged+=delegate(Objectsender,SelectionChangedEventArgse)...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)Int32previousSelectedIndex=e.PreviousSelectedIndex;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)if(previousSelectedIndex!=-1)...{//Iftherewasapreviousindex  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)//Changepreviously-selectedlistboxitemcolortounselectedcolor  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)((Text)m\_listbox.Items\[previousSelectedIndex].Child).ForeColor=unselectedItemColor;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)//Changenewly-selectedlistboxitemcolortoselectedcolor  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)((Text)m\_listbox.Items\[e.SelectedIndex].Child).ForeColor=selectedItemColor;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)};  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)//Addtheitemstothelistbox  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)foreach(StringsinnewString\[]...{"VerticalStack","HorizontalStack","Canvas","Diagonal"})...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)Texttext=newText(m\_app.NinaBFont,s+"PanelDemo");  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)text.ForeColor=unselectedItemColor;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)text.TextAlignment=TextAlignment.Center;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)text.Width=this.Width;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)ListBoxItemlbi=newListBoxItem();  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)lbi.Background=m\_listbox.Background;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)lbi.Child=text;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)m\_listbox.Items.Add(lbi);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)m\_listbox.SelectedIndex=0;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)//Addablanklineinthestack  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)panel.Children.Add(textflow=newTextFlow());  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)textflow.TextRuns.Add("",app.NinaBFont,instructionTextColor);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)textflow.Visibility=Visibility.Visible;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)//Thebottomchildcontainstextwithreturninstructions  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)textflow=newTextFlow();  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)textflow.TextAlignment=TextAlignment.Center;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)textflow.Visibility=Visibility.Visible;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)textflow.TextRuns.Add(  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)newTextRun("(AfterviewingaPanelDemo,hitEntertoreturntothisscreen)",  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)app.NinaBFont,instructionTextColor));  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)panel.Children.Add(textflow);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)protectedoverridevoidOnButtonDown(ButtonEventArgse)...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)//If&lt;Enter&gt;buttonispressed,gointotheselecteddemo  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)if(e.Button==Button.Select)...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)switch(MainListBox.SelectedIndex)...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)case0://VerticalStackPanelDemo  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)newStackPanelDemo(m\_app,Orientation.Vertical);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)break;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)case1://HorizontalStackPanelDemo  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)newStackPanelDemo(m\_app,Orientation.Horizontal);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)break;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)case2://CanvasPanelDemo  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)newCanvasPanelDemo(m\_app);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)break;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)case3://DiagonalPanelDemo  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)newDiagonalPanelDemo(m\_app);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)break;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)//Don'tcallbaseimplementation(base.OnButtonDown)orwe'llgobackHome  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)protectedoverridevoidOnGotFocus(FocusChangedEventArgse)...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)//Wheneverthiswindowgetsfocus,itgivesittoitslistbox  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)Buttons.Focus(m\_listbox);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)base.OnGotFocus(e);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)/\*\*///////////////////////////////////////////////////////////////////////////////  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)internalsealedclassStackPanelDemo:PresentationWindow...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)//ThisclassshowshowtobuildyourownshapedrawinginaDrawingContext  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)privatesealedclassCross:Shape...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)publicCross()...{}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)publicoverridevoidOnRender(DrawingContextdc)...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)//Drawalinefromtop,lefttobottom,right  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)dc.DrawLine(base.Stroke,0,0,Width,Height);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)//Drawalinefromtop,righttobottom,left  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)dc.DrawLine(base.Stroke,Width,0,0,Height);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)publicStackPanelDemo(MyAppapp,Orientationorientation)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif):base(app)...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)StackPanelpanel=newStackPanel(orientation);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)this.Child=panel;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)panel.Visibility=Visibility.Visible;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)Shape\[]shapes=newShape\[]...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)newEllipse(),  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)newLine(),  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)newPolygon(newInt32\[]...{0,0,50,0,50,50,0,50}),//ASquare  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)newRectangle(),  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)newCross()//Ourowncustomshape  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)};  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)for(Int32x=0;x&lt;shapes.Length;x++)...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)Shapes=shapes\[x];  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)s.Fill=newSolidColorBrush(ColorUtility.ColorFromRGB(0,255,0));  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)s.Stroke=newPen(Color.Black,2);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)s.Visibility=Visibility.Visible;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)s.HorizontalAlignment=HorizontalAlignment.Center;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)s.VerticalAlignment=VerticalAlignment.Center;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)s.Height=Height-1;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)s.Width=Width-1;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)if(panel.Orientation==Orientation.Horizontal)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)s.Width/=shapes.Length;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)else  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)s.Height/=shapes.Length;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)panel.Children.Add(s);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)/\*\*///////////////////////////////////////////////////////////////////////////////  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)internalsealedclassCanvasPanelDemo:PresentationWindow...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)publicCanvasPanelDemo(MyAppapp)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif):base(app)...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)Canvascanvas=newCanvas();  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)this.Child=canvas;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)this.Background=newSolidColorBrush(ColorUtility.ColorFromRGB(0,255,255));  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)for(Int32x=0;x&lt;Width;x+=Width/4)...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)for(Int32y=0;y&lt;Height;y+=Height/4)...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)Texttext=newText(m\_app.SmallFont,"("+x+","+y+")");  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)Canvas.SetLeft(text,x);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)Canvas.SetTop(text,y);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)canvas.Children.Add(text);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)/\*\*///////////////////////////////////////////////////////////////////////////////  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)internalsealedclassDiagonalPanelDemo:PresentationWindow...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)publicDiagonalPanelDemo(MyAppapp)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif):base(app)...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)DiagonalPanelpanel=newDiagonalPanel();  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)this.Child=panel;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)this.Background=newLinearGradientBrush(  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)ColorUtility.ColorFromRGB(192,0,0),ColorUtility.ColorFromRGB(32,0,0),0,0,Width,Height);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)for(Int32x=0;x&lt;4;x++)...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)Bitmapb=newBitmap(Width/4,Height/4);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)b.StretchImage(0,0,app.Snowflake,b.Width,b.Height,(UInt16)((x+1)\*50));  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)Imageimage=newImage(b);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)panel.Children.Add(image);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)//ThisclassshowshowtobuildyourownPanel  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)privatesealedclassDiagonalPanel:Panel...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)publicDiagonalPanel()...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)protectedoverridevoidMeasureOverride(intavailableWidth,intavailableHeight,outintdesiredWidth,outintdesiredHeight)...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)//Calledtocalculatethewidth/heightdesired  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)desiredWidth=0;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)desiredHeight=0;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)foreach(UIElementchildinChildren)...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)if(child.Visibility!=Visibility.Collapsed)...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)child.Measure(Int32.MaxValue,Int32.MaxValue);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)Int32childWidth,childHeight;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)child.GetDesiredSize(outchildWidth,outchildHeight);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)desiredWidth+=childWidth;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)desiredHeight+=childHeight;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)protectedoverridevoidArrangeOverride(intarrangeWidth,intarrangeHeight)...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)Int32x=0,y=0;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)foreach(UIElementchildinChildren)...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)if(child.Visibility!=Visibility.Collapsed)...{  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)Int32childWidth,childHeight;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)child.GetDesiredSize(outchildWidth,outchildHeight);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)child.Arrange(x,y,childWidth,childHeight);  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)x+=childWidth;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)y+=childHeight;  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)}  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)/\*\*///////////////////////////////////////////////////////////////////////////////  
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)

后记：此外在会上还遇到了我的偶像马宁、马琪、张欣（还是张欣强，通过回答问题获得一个MF开放套件），如果他们不介意附上照片作个留念:-)

![](http://p.blog.csdn.net/images/p_blog_csdn_net/yefanqiu/MVP070917.jpg)