摘要: 1.Never frown,because you never konw who is falling in love with your smile.别愁眉不展,因为你不知道谁会爱上你的笑容.2.In order to be irreplaceable,one must always be different.要做到不可替代,就要与众不同。3.Perfection is not just about control.It's also about letting go.完美不是控制出来的,是爆发出来的。《黑天鹅》4.Dear Daddy,I may find a prince som 阅读全文
posted @ 2013-05-27 08:40 夜曲984 阅读(127) 评论(0) 推荐(0) 编辑
摘要: 数组是在程序设计中,为了处理方便, 把具有相同类型的若干变量按有序的形式组织起来的一种形式。通俗点说:数组就是一个变量的索引列表,存储在数组类型的变量中。数组有一个基本类型,数组中的每个条目都是这种类型。1.数组的声明:类型[] 名称类型可以是任何变量类型,名称是编者自己取得方便读写的名称,数组在访问之前必须初始化。如下是错误的:int[] arraySort;arraySort[0] = 10;数组的初始化有两种方式:①使用字面值初始化指定数组:需用逗号隔开元素值列表如string[] nameList = {"aaaaa","bbbbb"," 阅读全文
posted @ 2013-05-26 10:43 夜曲984 阅读(447) 评论(0) 推荐(0) 编辑
摘要: 1.2-2算法测试:c#代码如下: 1 static void Main(string[] args) 2 { 3 Console.WriteLine("假设两种算法每执行一步为1m:"); 4 for (int n = 1; n <= 100;n++) 5 { 6 double insertAlgo = 8 * n * n; 7 double mergerAlog = 64 * n * System.Math.Log10(n); 8 Console.WriteLine("{0} 插入算法时间:{1}-------归并算... 阅读全文
posted @ 2013-05-18 11:14 夜曲984 阅读(127) 评论(0) 推荐(0) 编辑
摘要: 1.基本内容:ProgressBar控件不能和用户进行交互,用的最多的就是复制文件。颜色设置中,Foreground是设置走动的进度的颜色,Background是设置背景颜色,FlowDirection是流动的方向,有从左到右和从右到左。从左到右是最常见的,复制文件就是,从右到左一般在游戏中用的比较多,如某个英雄的血,开始满管,绿色,被攻击后从右向左由红到绿。2.使用上定义委托(转自http://blog.csdn.net/hjm2046/article/details/6690689)代码如下: 1 private delegate void UpdateProgressBarDelegat 阅读全文
posted @ 2013-05-17 14:16 夜曲984 阅读(1950) 评论(0) 推荐(0) 编辑
摘要: 1.简单的单一颜色使用SolidColorBrush画刷,如:1 button.Background = new SolidColorBrush(Colors.Green); 或者1 button.Background = new SolidColorBrush(SystemColors.ControlColor);也可以使用R、G、B设置:1 byte red = 0, green = 255, blue = 0;2 button.Foreground = new SolidColorBrush(Color.FromRgb(red, green, blue));注意这里的red、green. 阅读全文
posted @ 2013-05-17 09:24 夜曲984 阅读(330) 评论(0) 推荐(0) 编辑
摘要: 在wpf中button属于内容控件,它内部只能包含一项内容,但通过为其添加一个布局控件,而布局控件又可以放置很多的内容。一个简单的为Button放图片和画个菱形,代码如下: 1 <Grid> 2 <Button Height="55" Name="button1" Width="169" Margin="151,32,132,204" HorizontalContentAlignment="Center" Padding="5"> 3 <Imag 阅读全文
posted @ 2013-05-16 16:48 夜曲984 阅读(228) 评论(0) 推荐(0) 编辑
摘要: Grid就是表格,画表格代码如下: 1 <Grid ShowGridLines="True" Height="160" Width="309"> 2 <Grid.RowDefinitions> 3 <RowDefinition></RowDefinition> 4 <RowDefinition></RowDefinition> 5 <RowDefinition></RowDefinition> 6 </Grid.RowDefiniti 阅读全文
posted @ 2013-05-16 15:18 夜曲984 阅读(273) 评论(0) 推荐(0) 编辑
摘要: 在wpf中从一个页面跳转到另外一个一面,使用导航,比如从page1跳转到page2,代码如下:1 private void button9_Click(object sender, RoutedEventArgs e)2 {3 Page2 page2 = new Page2();4 this.NavigationService.Navigate(page2);5 }在新建了一个项目后,默认的起始页是从新建的第一个页面开始,当然可以更改为任意的页面作为起始页,打开App.xmal,代码如下:1 <Application x:Class="StackPanel.App"2 阅读全文
posted @ 2013-05-16 14:44 夜曲984 阅读(3076) 评论(0) 推荐(0) 编辑
摘要: 获取焦点下的元素,不如最后一个为button按钮,代码如下:1 Button bt = (Button)Keyboard.FocusedElement;现在就可以使用button了,1 MessageBox.Show(bt.Name);问题是需要使用之前点击过的控件,比如一个textbox按钮,需要把这个控件给存下来。可以定义一个全局的数组或是别的类型。1 object[] control = new object[10];2 for (int i = 0; i < 10; i++)3 {4 control[i] = Keyboard.FocusedElement;5 }并且需... 阅读全文
posted @ 2013-05-15 10:16 夜曲984 阅读(631) 评论(0) 推荐(0) 编辑
摘要: 使用C#获取光标相对于显示器屏幕的位置:方式一: 1 [csharp] view plaincopyprint? 2 using System; 3 using System.Drawing; 4 using System.Runtime.InteropServices; 5 6 namespace ColorPicker 7 { 8 /// <summary> 9 /// win8下wpf程序测试成功 10 /// </summary> 11 public class CursorPointManager 12 { ... 阅读全文
posted @ 2013-05-15 08:57 夜曲984 阅读(825) 评论(0) 推荐(0) 编辑