コード例 #1
0
ファイル: TestLable.cs プロジェクト: zhangopeng/WpfPaint
        private void InternalRenderComplete(object sender, EventArgs e)
        {
            this.DynamicRendererThreadManager.MainMediaContextRenderComplete -= this._mainRenderComplete;
            List <DryingDrawingVisual> dryingDrawingVisualList = this._dryingDrawingVisualList;
            bool flag = false;
            List <DryingDrawingVisual> source;

            try
            {
                Monitor.Enter(dryingDrawingVisualList, ref flag);
                source = this._dryingDrawingVisualList.ToList <DryingDrawingVisual>();
                this._dryingDrawingVisualList.Clear();
            }
            finally
            {
                Monitor.Exit(dryingDrawingVisualList);
            }
            var group = (from temp in source group temp by temp.ContainerVisual);

            foreach (var dryingDrawingVisual in group)
            {
                ContainerVisual containerVisual = dryingDrawingVisual.Key;
                if (!containerVisual.CheckAccess())
                {
                    containerVisual.Dispatcher.InvokeAsync(delegate()
                    {
                        TestLable.RemoveDrawingVisual(dryingDrawingVisual, containerVisual);
                    }, DispatcherPriority.Background);
                    continue;
                }
                TestLable.RemoveDrawingVisual(dryingDrawingVisual, containerVisual);
            }
        }
コード例 #2
0
ファイル: MouseRender.cs プロジェクト: zhangopeng/WpfPaint
 public MouseRender(TestLable inkCanvas)
 {
     AllowsMouseInput          = true;
     this._fillSolidColorBrush = MouseRender.DefaultFillSolidColorBrush;
     this._strokeInfoList      = new Dictionary <int, MouseRender.StrokeInfo>(50);
     this.InkCanvas            = inkCanvas;
     this._drawingAttributes   = new DrawingAttributes
     {
         FitToCurve     = false,
         IgnorePressure = false,
         StylusTip      = StylusTip.Ellipse,
         Color          = Colors.Blue,
         Width          = 3,
         Height         = 3
     };
     this._fillSolidColorBrush = Brushes.Red;
     //if (this._inkBoardSettings == null)
     //{
     //    InkBoardSettings inkBoardSettings = new InkBoardSettings
     //    {
     //        InkColor = MouseRender.DefaultFillSolidColorBrush.Color,
     //        InkThickness = 3.0
     //    };
     //    this.UpdateInkBoardSettingsInternal(inkBoardSettings);
     //}
 }
コード例 #3
0
 public InkCanvasThreadManager(TestLable inkCanvas, DynamicRendererThreadManager dynamicRendererThreadManager)
 {
     if (inkCanvas == null)
     {
         throw new ArgumentNullException("inkCanvas");
     }
     if (dynamicRendererThreadManager == null)
     {
         throw new ArgumentNullException("dynamicRendererThreadManager");
     }
     InkCanvas = inkCanvas;
     DynamicRendererThreadManager = dynamicRendererThreadManager;
 }