WPFUIElement的Background的问题
<Border Name="border" CornerRadius="" Margin="">
<Border.Background>
<VisualBrush>
<VisualBrush.Visual>
<Image Name="img" Stretch="UniformToFill" Grid.Row="" />
</VisualBrush.Visual>
</VisualBrush>
</Border.Background>
</Border>
以上代码 经过 下面的 打印之后 img的Source 改变值之后也不可变了..
RenderTargetBitmap bitmap = new RenderTargetBitmap((int)grid.ActualWidth, (int)grid.ActualHeight, , , PixelFormats.Pbgra32);
bitmap.Render(grid); PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler(pd_PrintPage); PngBitmapEncoder encode = new PngBitmapEncoder();
encode.Frames.Add(BitmapFrame.Create(bitmap));
MemoryStream ms = new MemoryStream();
encode.Save(ms);
bitmap.Clear();
drawimg = System.Drawing.Image.FromStream(ms);
//rect = new System.Drawing.Rectangle(0, 0, (int)grid.ActualWidth, (int)grid.ActualHeight);
pd.Print();
需要用 border.InvalidateVisual(); 重新计算 UI... 原因未知,先保留
WPFUIElement的Background的问题的更多相关文章
- css样式之background详解
background用法详解: 1.background-color 属性设置元素的背景颜色 可能的值 color_name 规定颜色值为颜色名称的背景颜色(比如 red) he ...
- css样式之background详解(格子效果)
background用法详解: 1.background-color 属性设置元素的背景颜色 可能的值 color_name 规定颜色值为颜色名称的背景颜色(比如 red) he ...
- CSS背景background、background-position使用详解
背景(background)是css中一个重要的的部分,也是需要知道的css的基础知识之一.这篇文章将会涉及css背景(background)的基本用法,包括诸如 background-attachm ...
- CSS 中关于background 属性功能
background 是 css中的核心属性,我们对他应该充分了解. background-image 定义背景图像 这个属性是我们用的最多的属性 设置背景图像有两个方式 background: ...
- 1 background(复合属性)与font(复合属性) 2 行内块的间距问题 3 行内元素的margin 4 清除浮动 5定位的元素的层级 6 Border-radius: 边框半径
1 background(复合属性)与font(复合属性): background: 颜色 图片的链接 是否平铺 背景位置 是否滚动.(可以随意调动或省略) Font: 粗度 字体风格 字体大小 ...
- Android什么时候进行View中Background的加载
对大多数Android的开发者来说,最经常的操作莫过于对界面进行布局,View中背景图片的加载是最经常做的.但是我们很少关注这个过程,这篇文章主要解析view中背景图片加载的流程.了解view中背景图 ...
- CSS中对图片(background)的一些设置心得总结
写网页的时候很多情况需要对图片进行操作,如何在不进行专业的美工裁切操作的情况下而让自己的素材度达到最大的满意度呢,这是一个问题,对于懒得开ps切图的我,通常会直接在网络上download一张图片,直接 ...
- PopupWindow 点击外部和返回键无法消失背后的真相(setBackgroundDrawable(Drawable background))
刚接手PopupWindow的时候,我们都可能觉得很简单,因为它确实很简单,不过运气不好的可能就会踩到一个坑: 点击PopupWindow最外层布局以及点击返回键PopupWindow不会消失 新手在 ...
- CSS背景background详解,background-position详解
背景(background)是css中一个重要的的部分,也是需要知道的css的基础知识之一.这篇文章将会涉及css背景(background)的基本用法,包括诸如 background-attachm ...
随机推荐
- ASP.NET Misconfiguration: Debug Information
Abstract: Debugging messages help attackers learn about the system and plan a form of attack. Explan ...
- [转]在WPF中区别TextBlock和Label
TextBlock和Label都是用来显示少量数据的.好多文章对Label存在的描述都是它允许使用"快速获取"."快速获取"就是允许你用Alt加上其它的按键快速 ...
- Spark-Mllib(二)基本统计
一.基本统计量 统计向量的长度,最大值,最小值,非0个数,模1和模2,方差等 import org.apache.spark.mllib.linalg.{Vector,Vectors} import ...
- iOS10以及xCode8相关资料收集
兼容iOS 10 资料整理笔记 源文:http://www.jianshu.com/p/0cc7aad638d9 1.Notification(通知) 自从Notification被引入之后,苹果就不 ...
- DIOCP之编写第一个应用程序(二)
构建client界面: 构建界面要比写代码更难爱,不是专业UI设计太丑,先有个界面,好写代码,客户端代码与界面设计思想:界面与数据之间分离处理,不能要接收数据的地方写代码,不然以后修改程序会死人的.
- oracle 模糊查询中的转义字符用法
drop view aaa; create view aaa as select '_BCDE' A FROM DUAL UNION ALL SELECT 'ABCDE' FROM DUAL UNIO ...
- Struts2------通配符
<struts> <package namespace="/" extends="struts-default" name="tes ...
- 让div固定在顶部不随滚动条滚动
让div固定在顶部不随滚动条滚动 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "h ...
- iOS架构基础
1.概念:架构其实是一个设计上的东西,它可以小到类类之间的交互,可以大到不痛的模块之间,可以说不痛的业务部门之间的交互都可以从架构的层面去理解它. 2.解耦 方法一:代理 方法二:通知
- 关于apache httpd.conf脚本的理解
新人一枚,这两天一直在研究lamp的搭建,感觉自己对apache理解的不够深彻,决定写这一篇(翻译)httpd.conf文件 未完待续 cat /usr/local/apache/conf/httpd ...