Exemplo n.º 1
0
        public static Cursor CreateBmpCursor(Bitmap cursorBitmap)
        {

            var c = new BitmapCursor(cursorBitmap);

            return CursorInteropHelper.Create(c);
        }
Exemplo n.º 2
0
        private void OnLoaded(object sender, RoutedEventArgs e)
        {
            //make the render effect same as SnapsToDevicePixels
            //"SnapsToDevicePixels = true;" doesn't work on "OnRender"
            //however, this maybe make some offset form the render target's origin location
            //SetValue(RenderOptions.EdgeModeProperty, EdgeMode.Aliased);

            //ini this
            Cursor     = BitmapCursor.CreateCrossCursor();
            Background = Brushes.Transparent;



            //ini mask rect
            maskRectLeft.Fill = maskRectRight.Fill = maskRectTop.Fill = maskRectBottom.Fill = Config.MaskWindowBackground;

            //these propeties(x, y...) will not changed
            SetLeft(maskRectLeft, 0);
            SetTop(maskRectLeft, 0);
            SetRight(maskRectRight, 0);
            SetTop(maskRectRight, 0);
            SetTop(maskRectTop, 0);
            SetBottom(maskRectBottom, 0);
            maskRectLeft.Height = ActualHeight;


            Children.Add(maskRectLeft);
            Children.Add(maskRectRight);
            Children.Add(maskRectTop);
            Children.Add(maskRectBottom);

            //ini selection border
            selectionBorder.Stroke          = Config.SelectionBorderBrush;
            selectionBorder.StrokeThickness = Config.SelectionBorderThickness.Left;
            selectionBorder.StrokeDashArray = new DoubleCollection(new Double[] { 5, 2 });

            Children.Add(selectionBorder);

            //ini indicator
            indicator = new IndicatorObject(this);
            Children.Add(indicator);

            CompositionTarget.Rendering += OnCompositionTargetRendering;
        }
Exemplo n.º 3
0
        public static Cursor CreateBmpCursor(Bitmap cursorBitmap)
        {
            var c = new BitmapCursor(cursorBitmap);

            return(CursorInteropHelper.Create(c));
        }