silverlight 常用代码备忘

来源:互联网 发布:linux如何创建目录 编辑:程序博客网 时间:2024/05/22 16:07

 

 (1)TextBlock:

               Run run1 = new Run();

                run1.Text =getSJ(maxps.时间) + "出现最大降雨:" + maxps.水位 + "mm";

                run1.FontSize = 12;

                run1.Foreground = new System.Windows.Media.SolidColorBrush(Colors.Red);

                inf.Inlines.Add(run1);

 

(2) ImageBrush br = new ImageBrush();
            br.ImageSource = new BitmapImage(new Uri(url, UriKind.Relative));

//相对路径以上只能读取clientBin目录下的文件。对于上级文件:new Uri(App.Current.Host.Source, "../images/a/boo.png");
            br.Stretch = Stretch.Fill;
            br.AlignmentX = AlignmentX.Left;
            br.AlignmentY = AlignmentY.Top;

 

(3)常见中文字体与FontFamily映射表  

宋体(英文不等宽)―――― Simsun  
宋体(英文等宽)―――――― NSimsun  
楷体 ――――――――――――――― KaiTi
黑体 ――――――――――――――― SimHei  
仿宋 ――――――――――――――― FangSong  
微软正黑体 ―――――――――― Microsoft JhengHei  
细明体 ――――――――――――― MingLiu  
微软雅黑 ――――――――――― Microsoft YaHei  
隶书 ――――――――――――― LiSu(只能打包,不支持本地系统引用)  
华文彩云 ―――――――――――――STCaiyun (只能打包,不支持本地系统引用)  
华文琥珀 ―――――――――――――STHupo(只能打包,不支持本地系统引用)  
华文隶书 ―――――――――――――STLiti(只能打包,不支持本地系统引用)  
华文新魏 ―――――――――――――STXinwei(只能打包,不支持本地系统引用)  
华文行楷 ―――――――――――――STXingkai(只能打包,不支持本地系统引用)  
幼圆 ―――――――――――――YouYuan(只能打包,不支持本地系统引用 

 

 

原创粉丝点击