摘要:<Window x:Class="WpfApplication5.Window4" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window4" Height="1080" Width="1000"> <Canvas> <Image Wi
阅读全文
摘要:一、引言自己也算是使用Singleton的老客户了,也明白如何写代码能最大限度的避免多线程产生多个实例。但是自己却很少遇到在多线程下使用Singleton,所以自己也是一知半解。今天正好有空,搞搞清楚这个问题。二、问题的产生请看如下代码:public class Animal { private static Animal instance = null; private Animal() { } public static Animal getInstance() { if (instance == null) { instance = new Animal(); } return inst
阅读全文
摘要:1、InkCanvas类。实现画板需要用到InkCanvas。一般情况下不需任何代码就可以在上面画线了。如果需要设置画笔颜色、笔尖大小等就需要设置DefaultDrawingAttributes,例如:DrawingAttributes attributes = new DrawingAttributes();attributes.Color = Colors.Black;attributes.Height = 50;attributes.Width = 50;attributes.FitToCurve = true;2、在InkCanvas上画直线方法:在StrokeCollected事件中
阅读全文