Esempio n. 1
0
        internal Cursor(CursorInfo cursorInfo)
        {
            if (cursorInfo == null)
                throw new ArgumentNullException("cursorInfo");

            CursorInfo = cursorInfo;
            State = new CursorState(this);
        }
Esempio n. 2
0
        private static void DeclareCursors(IQuery query)
        {
            var queryExp1 = (SqlQueryExpression)SqlExpression.Parse("SELECT * FROM APP.test_table");
            query.Context.DeclareCursor("c1", queryExp1);

            var queryExp2 = (SqlQueryExpression)SqlExpression.Parse("SELECT * FROM APP.test_table WHERE a > :a");
            var cursorInfo = new CursorInfo("c2", queryExp2);
            cursorInfo.Parameters.Add(new CursorParameter("a", PrimitiveTypes.Integer()));
            query.Context.DeclareCursor(cursorInfo);
        }
        public static void DeclareCursor(this IRequest context, CursorInfo cursorInfo)
        {
            var queryPlan = context.Context.QueryPlanner().PlanQuery(new QueryInfo(context, cursorInfo.QueryExpression));
            var selectedTables = queryPlan.DiscoverTableNames();
            foreach (var tableName in selectedTables) {
                if (!context.Query.UserCanSelectFromTable(tableName))
                    throw new MissingPrivilegesException(context.Query.UserName(), tableName, Privileges.Select);
            }

            context.Context.DeclareCursor(cursorInfo);
        }
Esempio n. 4
0
        public void DeclareCursor(CursorInfo cursorInfo)
        {
            if (cursorInfo == null)
                throw new ArgumentNullException("cursorInfo");

            lock (this) {
                var cursorName = cursorInfo.CursorName;
                if (cursors.Any(x => x.CursorInfo.CursorName.Equals(cursorName, StringComparison.OrdinalIgnoreCase)))
                    throw new ArgumentException(String.Format("Cursor '{0}' was already declared.", cursorName));

                var cursor = new Cursor(cursorInfo);
                cursors.Add(cursor);
            }
        }
        public static bool DeclareCursor(this IContext context, CursorInfo cursorInfo)
        {
            if (context.CursorExists(cursorInfo.CursorName))
                throw new InvalidOperationException(String.Format("A cursor named '{0}' was already defined in the context.",
                    cursorInfo.CursorName));

            var currentContext = context;
            while (currentContext != null) {
                if (currentContext is ICursorScope) {
                    var scope = (ICursorScope)currentContext;
                    scope.DeclareCursor(cursorInfo);
                    return true;
                }

                currentContext = currentContext.Parent;
            }

            return false;
        }
        public override void SimulationStep()
        {
            base.SimulationStep();

            var mouseRayValid = !UIView.IsInsideUI() && Cursor.visible && !cursorInSecondaryPanel;

            if (mouseRayValid)
            {
                var mouseRay = Camera.main.ScreenPointToRay(Input.mousePosition);
                var mouseRayLength = Camera.main.farClipPlane;
                var rayRight = Camera.main.transform.TransformDirection(Vector3.right);

                var defaultService = new ToolBase.RaycastService(ItemClass.Service.Road, ItemClass.SubService.None, ItemClass.Layer.Default);
                var input = new ToolBase.RaycastInput(mouseRay, mouseRayLength)
                {
                    m_rayRight = rayRight,
                    m_netService = defaultService,
                    m_ignoreNodeFlags = NetNode.Flags.None,
                    m_ignoreSegmentFlags = NetSegment.Flags.Untouchable
                };
                RaycastOutput output;
                if (!RayCast(input, out output))
                {
                    _hoveredSegmentIdx = 0;
                    _hoveredNetNodeIdx = 0;
                    return;
                }

                _hoveredNetNodeIdx = output.m_netNode;

                _hoveredSegmentIdx = output.m_netSegment;
            }

            if (toolMode == ToolMode.None)
            {
                ToolCursor = null;
            }
            else
            {
                NetTool netTool = null;

                foreach (var tool in ToolsModifierControl.toolController.Tools)
                {
                    NetTool nt = tool as NetTool;
                    if (nt != null && nt.m_prefab != null)
                    {
                        netTool = nt;
                        break;
                    }
                }

                if (netTool != null && mouseRayValid)
                {
                    ToolCursor = netTool.m_upgradeCursor;
                }
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Takes a screenshot of th entire area and add to the list, plus add to the list the position and icon of the cursor.
        /// </summary>
        private void timerCapWithCursorFull_Tick(object sender, EventArgs e)
        {
            _cursorInfo = new CursorInfo
            {
                Icon = _capture.CaptureIconCursor(ref _posCursor),
                Position = _posCursor,
                Clicked = _recordClicked
            };

            //saves to list the actual icon and position of the cursor
            _listCursor.Add(_cursorInfo);

            //Take a screenshot of the area.
            _gr.CopyFromScreen(0, 0, 0, 0, _sizeResolution, CopyPixelOperation.SourceCopy);
            //Add the bitmap to a list

            _addDel.BeginInvoke(String.Format("{0}{1}.bmp", _pathTemp, _frameCount), new Bitmap(_bt), CallBack, null);

            this.Invoke((Action)(() => this.Text = String.Format("Screen To Gif • {0}", _frameCount)));

            _frameCount++;
        }
 public static void DeclareCursor(this ICursorScope scope, CursorInfo cursorInfo)
 {
     scope.CursorManager.DeclareCursor(cursorInfo);
 }
Esempio n. 9
0
 public static extern bool GetCursorInfo(out CursorInfo info);
Esempio n. 10
0
 public Task SendCursorChange(CursorInfo cursor, string viewerID)
 {
     return(ViewerHubContext.Clients.Client(viewerID).SendAsync("CursorChange", cursor));
 }
 bool IDisplayHandler.OnCursorChange(IWebBrowser chromiumWebBrowser, IBrowser browser, IntPtr cursor, CursorType type, CursorInfo customCursorInfo)
 {
     return(false);
 }
Esempio n. 12
0
        public static Bitmap CaptureImageCursor(ref Point point)
        {
            try
            {
                var cursorInfo = new CursorInfo();
                cursorInfo.cbSize = Marshal.SizeOf(cursorInfo);

                if (!GetCursorInfo(out cursorInfo))
                {
                    return(null);
                }

                if (cursorInfo.flags != CursorShowing)
                {
                    return(null);
                }

                var hicon = CopyIcon(cursorInfo.hCursor);
                if (hicon == IntPtr.Zero)
                {
                    return(null);
                }

                IconInfo iconInfo;
                if (!GetIconInfo(hicon, out iconInfo))
                {
                    DestroyIcon(hicon);
                    return(null);
                }

                point.X = cursorInfo.ptScreenPos.X - iconInfo.xHotspot;
                point.Y = cursorInfo.ptScreenPos.Y - iconInfo.yHotspot;

                using (var maskBitmap = Image.FromHbitmap(iconInfo.hbmMask))
                {
                    //Is this a monochrome cursor?
                    if (maskBitmap.Height == maskBitmap.Width * 2 && iconInfo.hbmColor == IntPtr.Zero)
                    {
                        var final     = new Bitmap(maskBitmap.Width, maskBitmap.Width);
                        var hDesktop  = GetDesktopWindow();
                        var dcDesktop = GetWindowDC(hDesktop);

                        using (var resultGraphics = Graphics.FromImage(final))
                        {
                            var resultHdc = resultGraphics.GetHdc();

                            BitBlt(
                                resultHdc,
                                0,
                                0,
                                final.Width,
                                final.Height,
                                dcDesktop,
                                (int)point.X + 3,
                                (int)point.Y + 3,
                                CopyPixelOperation.SourceCopy
                                );
                            DrawIconEx(resultHdc, 0, 0, cursorInfo.hCursor, 0, 0, 0, IntPtr.Zero, 0x0003);

                            //TODO: I have to try removing the background of this cursor capture.
                            //Native.BitBlt(resultHdc, 0, 0, final.Width, final.Height, dcDesktop, (int)point.X + 3, (int)point.Y + 3, Native.CopyPixelOperation.SourceErase);

                            resultGraphics.ReleaseHdc(resultHdc);
                            ReleaseDC(hDesktop, dcDesktop);
                        }

                        DeleteObject(iconInfo.hbmMask);
                        DeleteDC(dcDesktop);
                        DestroyIcon(hicon);

                        return(final);
                    }

                    DeleteObject(iconInfo.hbmColor);
                    DeleteObject(iconInfo.hbmMask);
                    DestroyIcon(hicon);
                }

                var icon = Icon.FromHandle(hicon);
                return(icon.ToBitmap());
            }
            catch (Exception ex)
            {
                //You should catch exception with your method here.
                //LogWriter.Log(ex, "Impossible to get the cursor.");
            }

            return(null);
        }
Esempio n. 13
0
 public async Task SendCursorChange(CursorInfo cursorInfo)
 {
     await SendToViewer(() => RtcSession.SendCursorChange(cursorInfo),
                        () => CasterSocket.SendCursorChange(cursorInfo, ViewerConnectionID));
 }
Esempio n. 14
0
        protected override void OnAfterSetup(string testName)
        {
            var tableName = ObjectName.Parse("APP.test_table");

            AdminQuery.Access().CreateTable(tableBuilder => tableBuilder
                .Named(tableName)
                .WithColumn("a", PrimitiveTypes.Integer())
                .WithColumn("b", PrimitiveTypes.String()));

            var table = AdminQuery.Access().GetMutableTable(tableName);
            for (int i = 0; i < 10; i++) {
                var row = table.NewRow();
                row.SetValue(0, i);
                row.SetValue(1, String.Format("ID: {0}", i));
                table.AddRow(row);
            }

            var query = (SqlQueryExpression)SqlExpression.Parse("SELECT * FROM APP.test_table");

            var cursorInfo = new CursorInfo("c1", query);
            cursorInfo.Flags = CursorFlags.Scroll;

            AdminQuery.Access().CreateObject(cursorInfo);
            var c1 = (Cursor)AdminQuery.Access().GetObject(DbObjectType.Cursor, new ObjectName("c1"));
            c1.Open(AdminQuery);

            if (testName.StartsWith("FetchInto")) {
                var query2 = (SqlQueryExpression)SqlExpression.Parse("SELECT a FROM APP.test_table");

                var cursorInfo2 = new CursorInfo("c2", query2);
                cursorInfo2.Flags = CursorFlags.Scroll;

                AdminQuery.Access().CreateObject(cursorInfo2);
                var c2 = (Cursor)AdminQuery.Access().GetObject(DbObjectType.Cursor, new ObjectName("c2"));
                c2.Open(AdminQuery);

                AdminQuery.Access().CreateObject(new VariableInfo("var1", PrimitiveTypes.BigInt(), false));
                AdminQuery.Access().CreateObject(new VariableInfo("var2", PrimitiveTypes.String(), false));
            }
        }
Esempio n. 15
0
 public async Task SendCursorChange(CursorInfo cursor, List <string> viewerIDs)
 {
     await RCBrowserHub.Clients.Clients(viewerIDs).SendAsync("CursorChange", cursor);
 }
Esempio n. 16
0
        /// <summary>
        /// Do the actual frame capture
        /// </summary>
        private void CaptureFrame()
        {
            int MSBETWEENCAPTURES = 1000 / framesPerSecond;
            int msToNextCapture   = MSBETWEENCAPTURES;

            stopwatch.Reset();
            while (!stop)
            {
                stopwatch.Start();
                Point captureLocation;
                if (recordingWindow != null)
                {
                    recordingWindow.Reset();
                    captureLocation = recordingWindow.Location;
                }
                else
                {
                    captureLocation = new Point(recordingRectangle.X, recordingRectangle.Y);
                }
                // "Capture"
                GDI32.BitBlt(hDCDest, 0, 0, recordingSize.Width, recordingSize.Height, hDCDesktop, captureLocation.X, captureLocation.Y, CopyPixelOperation.SourceCopy);
                //GDI32.BitBlt(hDCDest, 0, 0, recordingSize.Width, recordingSize.Height, hDCDesktop, captureLocation.X, captureLocation.Y, CopyPixelOperation.SourceCopy | CopyPixelOperation.CaptureBlt);

                // Mouse
                if (RecordMouse)
                {
                    CursorInfo cursorInfo = new CursorInfo();
                    cursorInfo.cbSize = Marshal.SizeOf(cursorInfo);
                    Point mouseLocation = Cursor.Position;
                    mouseLocation.Offset(-captureLocation.X, -captureLocation.Y);
                    if (User32.GetCursorInfo(out cursorInfo))
                    {
                        User32.DrawIcon(hDCDest, mouseLocation.X, mouseLocation.Y, cursorInfo.hCursor);
                    }
                }
                // add to avi
                try {
                    aviWriter.AddLowLevelFrame(bits0);
                } catch (Exception) {
                    LOG.Error("Error adding frame to avi, stopping capturing.");
                    break;
                }

                int restTime = (int)(msToNextCapture - stopwatch.ElapsedMilliseconds);

                // Set time to next capture, we correct it if needed later.
                msToNextCapture = MSBETWEENCAPTURES;
                if (restTime > 0)
                {
                    // We were fast enough, we wait for next capture
                    Thread.Sleep(restTime);
                }
                else if (restTime < 0)
                {
                    // Compensating, as we took to long
                    int framesToSkip   = ((-restTime) / MSBETWEENCAPTURES);
                    int leftoverMillis = (-restTime) % MSBETWEENCAPTURES;
                    //LOG.InfoFormat("Adding {0} empty frames to avi, leftover millis is {1}, sleeping {2} (of {3} total)", framesToSkip, leftover, sleepMillis, MSBETWEENCAPTURES);
                    aviWriter.AddEmptyFrames(framesToSkip);

                    // check how bad it is, if we only missed our target by a few millis we hope the next capture corrects this
                    if (leftoverMillis > 0 && leftoverMillis <= 2)
                    {
                        // subtract the leftover from the millis to next capture, do nothing else
                        msToNextCapture -= leftoverMillis;
                    }
                    else if (leftoverMillis > 0)
                    {
                        // it's more, we add an empty frame
                        aviWriter.AddEmptyFrames(1);
                        // we sleep to the next time and
                        int sleepMillis = MSBETWEENCAPTURES - leftoverMillis;
                        // Sleep to next capture
                        Thread.Sleep(sleepMillis);
                    }
                }
                stopwatch.Reset();
            }
            Cleanup();
        }
Esempio n. 17
0
        /// <summary>
        /// Draws this overlay.
        /// </summary>
        /// <param name="G">A <see cref="Graphics"/> object to draw upon.</param>
        /// <param name="Transform">Point Transform Function.</param>
        public static void Draw(Graphics G, Func <Point, Point> Transform = null)
        {
            // ReSharper disable once RedundantAssignment
            // ReSharper disable once InlineOutVariableDeclaration
            var cursorInfo = new CursorInfo {
                cbSize = Marshal.SizeOf <CursorInfo>()
            };

            if (!User32.GetCursorInfo(out cursorInfo))
            {
                return;
            }

            if (cursorInfo.flags != CursorShowing)
            {
                return;
            }

            Bitmap icon;
            Point  hotspot;

            if (Cursors.ContainsKey(cursorInfo.hCursor))
            {
                var tuple = Cursors[cursorInfo.hCursor];

                icon    = tuple.Item1;
                hotspot = tuple.Item2;
            }
            else
            {
                var hIcon = User32.CopyIcon(cursorInfo.hCursor);

                if (hIcon == IntPtr.Zero)
                {
                    return;
                }

                if (!User32.GetIconInfo(hIcon, out var icInfo))
                {
                    return;
                }

                icon    = Icon.FromHandle(hIcon).ToBitmap();
                hotspot = new Point(icInfo.xHotspot, icInfo.yHotspot);

                Cursors.Add(cursorInfo.hCursor, Tuple.Create(icon, hotspot));

                User32.DestroyIcon(hIcon);

                Gdi32.DeleteObject(icInfo.hbmColor);
                Gdi32.DeleteObject(icInfo.hbmMask);
            }

            var location = new Point(cursorInfo.ptScreenPos.X - hotspot.X,
                                     cursorInfo.ptScreenPos.Y - hotspot.Y);

            if (Transform != null)
            {
                location = Transform(location);
            }

            try
            {
                G.DrawImage(icon, new Rectangle(location, icon.Size));
            }
            catch (ArgumentException) { }
        }
Esempio n. 18
0
 protected virtual void OnCursorChange(IntPtr cursor, CursorType type, CursorInfo customCursorInfo)
 {
     RenderHandler?.OnCursorChange(cursor, type, customCursorInfo);
 }
Esempio n. 19
0
 public void OnCursorChange(IntPtr cursor, CursorType type, CursorInfo customCursorInfo)
 {
     CursorChange?.Invoke(this, new CursorChangeEventArgs(cursor, type, customCursorInfo));
 }
Esempio n. 20
0
 public async Task SendCursorChange(CursorInfo cursor, List <string> viewerIDs)
 {
     await Connection.SendAsync("SendCursorChange", cursor, viewerIDs);
 }
 /// <summary>
 /// Called when the browser's cursor has changed.
 /// </summary>
 /// <param name="cursor">If type is Custom then customCursorInfo will be populated with the custom cursor information</param>
 /// <param name="type">cursor type</param>
 /// <param name="customCursorInfo">custom cursor Information</param>
 public virtual void OnCursorChange(IntPtr cursor, CursorType type, CursorInfo customCursorInfo)
 {
 }
Esempio n. 22
0
 private static extern bool GetCursorInfo(out CursorInfo pci);
Esempio n. 23
0
        // TODO: assert access to the resources
        protected override void ExecuteStatement(ExecutionContext context)
        {
            var cursorInfo = new CursorInfo(CursorName, Flags, QueryExpression);
            if (Parameters != null) {
                foreach (var parameter in Parameters) {
                    cursorInfo.Parameters.Add(parameter);
                }
            }

            // TODO:
            //var queryPlan = context.Request.Context.QueryPlanner().PlanQuery(new QueryInfo(context.Request, QueryExpression));
            //var selectedTables = queryPlan.DiscoverAccessedResources();
            //foreach (var tableName in selectedTables) {
            //	if (!context.User.CanSelectFromTable(tableName))
            //		throw new MissingPrivilegesException(context.User.Name, tableName, Privileges.Select);
            //}

            context.Request.Context.DeclareCursor(cursorInfo);
        }
 public static extern bool GetCursorInfo(ref CursorInfo cursorInfo);
Esempio n. 25
0
 protected GLControl()
 {
     cursorInfo = new CursorInfo(this);
 }
Esempio n. 26
0
 void IRenderWebBrowser.OnCursorChange(IntPtr cursor, CursorType type, CursorInfo customCursorInfo)
 {
     target.Cursor = new Cursor(cursor);
 }
Esempio n. 27
0
 private static extern bool GetCursorInfo(ref CursorInfo cursorInfo);
Esempio n. 28
0
        static void GetIcon(Func <Point, Point> Transform, out Bitmap Icon, out Point Location)
        {
            Icon     = null;
            Location = Point.Empty;

            // ReSharper disable once RedundantAssignment
            // ReSharper disable once InlineOutVariableDeclaration
            var cursorInfo = new CursorInfo {
                cbSize = Marshal.SizeOf <CursorInfo>()
            };

            if (!User32.GetCursorInfo(out cursorInfo))
            {
                return;
            }

            if (cursorInfo.flags != CursorShowing)
            {
                return;
            }

            Point hotspot;

            if (Cursors.ContainsKey(cursorInfo.hCursor))
            {
                var tuple = Cursors[cursorInfo.hCursor];

                Icon    = tuple.Item1;
                hotspot = tuple.Item2;
            }
            else
            {
                var hIcon = User32.CopyIcon(cursorInfo.hCursor);

                if (hIcon == IntPtr.Zero)
                {
                    return;
                }

                if (!User32.GetIconInfo(hIcon, out var icInfo))
                {
                    return;
                }

                Icon    = System.Drawing.Icon.FromHandle(hIcon).ToBitmap();
                hotspot = new Point(icInfo.xHotspot, icInfo.yHotspot);

                Cursors.Add(cursorInfo.hCursor, Tuple.Create(Icon, hotspot));

                User32.DestroyIcon(hIcon);

                Gdi32.DeleteObject(icInfo.hbmColor);
                Gdi32.DeleteObject(icInfo.hbmMask);
            }

            Location = new Point(cursorInfo.ptScreenPos.X - hotspot.X,
                                 cursorInfo.ptScreenPos.Y - hotspot.Y);

            if (Transform != null)
            {
                Location = Transform(Location);
            }
        }
Esempio n. 29
0
        protected override void Awake()
        {
            Log.debug("Create Button");
            toggleButton = ReportButton.Create();
            toggleButton.eventClick += OnButtonToggled;

            Log.debug("Create UI...");
            ui = ReportUI.Create();
            ui.enabled = false;
            ui.absolutePosition = new Vector2(-1000, 0);
            ui.eventHighlightType += (String s) => { SetHighlight(s); };

            Log.debug("Create Analyzer...");
            analyzer = new TrafficAnalyzer();
            analyzer.OnReport += OnGotReport;

            Log.debug("Create Path Controller...");
            paths = new PathController(this);

            Log.info("Load Cursor...");
            m_cursor = CursorInfo.CreateInstance<CursorInfo>();
            m_cursor.m_texture = ResourceLoader.loadTexture("Materials/Cursor.png");
            m_cursor.m_hotspot = new Vector2(0, 0);

            loadingCursor = CursorInfo.CreateInstance<CursorInfo>();
            loadingCursor.m_texture = ResourceLoader.loadTexture("Materials/Hourglass.png");

            Log.info("QueryTool awoken");
            base.Awake();
        }
        protected override void ExecuteStatement(ExecutionContext context)
        {
            var cursorInfo = new CursorInfo(CursorName, Flags, QueryExpression);
            if (Parameters != null) {
                foreach (var parameter in Parameters) {
                    cursorInfo.Parameters.Add(parameter);
                }
            }

            context.Request.Query.DeclareCursor(cursorInfo);
        }
Esempio n. 31
0
        /// <summary>
        /// Takes a screenshot of desired area and add to the list, plus add to the list the position and icon of the cursor.
        /// </summary>
        private void timerCapWithCursor_Tick(object sender, EventArgs e)
        {
            _cursorInfo = new CursorInfo
            {
                IconImage = _capture.CaptureImageCursor(ref _posCursor),
                Position = panelTransparent.PointToClient(_posCursor),
                Clicked = _recordClicked,
            };

            //Get actual icon of the cursor
            _listCursor.Add(_cursorInfo);
            //Get the actual position of the form.
            Point lefttop = new Point(this.Location.X + panelTransparent.Location.X, this.Location.Y + panelTransparent.Location.Y);
            //Take a screenshot of the area.
            _gr.CopyFromScreen(lefttop.X, lefttop.Y, 0, 0, panelTransparent.Bounds.Size, CopyPixelOperation.SourceCopy);
            //Add the bitmap to a list

            _addDel.BeginInvoke(String.Format("{0}{1}.bmp", _pathTemp, _frameCount), new Bitmap(_bt), CallBack, null);

            this.Invoke((Action)(() => this.Text = String.Format("Screen To Gif • {0}", _frameCount)));

            _frameCount++;
            GC.Collect(1);
        }
Esempio n. 32
0
        public static MyCursor CaptureCursor()
        {
            CursorInfo cursorInfo = new CursorInfo();
            cursorInfo.cbSize = Marshal.SizeOf(cursorInfo);

            if (GetCursorInfo(out cursorInfo) && cursorInfo.flags == CURSOR_SHOWING)
            {
                cursorInfo.ptScreenPos = NativeMethods.ConvertPoint(Cursor.Position);

                IntPtr hicon = CopyIcon(cursorInfo.hCursor);
                if (hicon != IntPtr.Zero)
                {
                    IconInfo iconInfo;
                    if (GetIconInfo(hicon, out iconInfo))
                    {
                        Point position = new Point(cursorInfo.ptScreenPos.X - iconInfo.xHotspot, cursorInfo.ptScreenPos.Y - iconInfo.yHotspot);

                        using (Bitmap maskBitmap = Bitmap.FromHbitmap(iconInfo.hbmMask))
                        {
                            Bitmap resultBitmap = null;

                            if (IsCursorMonochrome(maskBitmap))
                            {
                                resultBitmap = new Bitmap(maskBitmap.Width, maskBitmap.Width);

                                Graphics desktopGraphics = Graphics.FromHwnd(GetDesktopWindow());
                                IntPtr desktopHdc = desktopGraphics.GetHdc();

                                IntPtr maskHdc = GDI.CreateCompatibleDC(desktopHdc);
                                IntPtr oldPtr = GDI.SelectObject(maskHdc, maskBitmap.GetHbitmap());

                                using (Graphics resultGraphics = Graphics.FromImage(resultBitmap))
                                {
                                    IntPtr resultHdc = resultGraphics.GetHdc();

                                    // These two operation will result in a black cursor over a white background.
                                    // Later in the code, a call to MakeTransparent() will get rid of the white background.
                                    GDI.BitBlt(resultHdc, 0, 0, 32, 32, maskHdc, 0, 32, CopyPixelOperation.SourceCopy);
                                    GDI.BitBlt(resultHdc, 0, 0, 32, 32, maskHdc, 0, 0, CopyPixelOperation.SourceInvert);

                                    resultGraphics.ReleaseHdc(resultHdc);
                                }

                                IntPtr newPtr = GDI.SelectObject(maskHdc, oldPtr);
                                GDI.DeleteDC(newPtr);
                                GDI.DeleteDC(maskHdc);
                                desktopGraphics.ReleaseHdc(desktopHdc);

                                // Remove the white background from the BitBlt calls,
                                // resulting in a black cursor over a transparent background.
                                resultBitmap.MakeTransparent(Color.White);
                            }
                            else
                            {
                                resultBitmap = Icon.FromHandle(hicon).ToBitmap();
                            }

                            return new MyCursor(new Cursor(cursorInfo.hCursor), position, resultBitmap);
                        }
                    }
                }
            }

            return new MyCursor();
        }
Esempio n. 33
0
 void IRenderHandler.OnCursorChange(IntPtr cursor, CursorType type, CursorInfo customCursorInfo)
 {
 }
Esempio n. 34
0
 internal static extern bool GetCursorInfo(ref CursorInfo Info);
 public bool OnCursorChange(IWebBrowser chromiumWebBrowser, IBrowser browser, IntPtr cursor, CursorType type, CursorInfo customCursorInfo)
 {
     return(false);
 }
Esempio n. 36
0
 public CursorChangeEventArgs(IntPtr cursor, CursorType type, CursorInfo customCursorInfo)
 {
     Cursor           = cursor;
     Type             = type;
     CustomCursorInfo = customCursorInfo;
 }
Esempio n. 37
0
        /// <summary>
        /// Takes a screenshot of desired area and add to the list, plus add to the list the position and icon of the cursor.
        /// </summary>
        private void timerCapWithCursor_Tick(object sender, EventArgs e)
        {
            _cursorInfo = new CursorInfo
            {
                Icon = _capture.CaptureIconCursor(ref _posCursor),
                Position = panelTransparent.PointToClient(_posCursor)
            };

            //saves to list the actual icon and position of the cursor
            _listCursor.Add(_cursorInfo);
            //Get the actual position of the form.
            Point lefttop = new Point(_caller.Location.X + _offsetX, _caller.Location.Y + _offsetY);
            //Take a screenshot of the area.
            _gr.CopyFromScreen(lefttop.X, lefttop.Y, 0, 0, panelTransparent.Bounds.Size, CopyPixelOperation.SourceCopy);
            //Add the bitmap to a list
            _listBitmap.Add((Bitmap)_bt.Clone());
        }
Esempio n. 38
0
 /// <summary>
 /// Called when the browser's cursor has changed. .
 /// </summary>
 /// <param name="cursor">If type is Custom then customCursorInfo will be populated with the custom cursor information</param>
 /// <param name="type">cursor type</param>
 /// <param name="customCursorInfo">custom cursor Information</param>
 void IRenderWebBrowser.OnCursorChange(IntPtr cursor, CursorType type, CursorInfo customCursorInfo)
 {
     RenderHandler?.OnCursorChange(cursor, type, customCursorInfo);
 }
Esempio n. 39
0
 public static extern bool GetCursorInfo(out CursorInfo pci);
Esempio n. 40
0
 public static extern bool GetCursorInfo(out CursorInfo pci);
Esempio n. 41
0
        public GameCursor()
        {
            _tooltip = new Tooltip();

            for (int i = 0; i < 2; i++)
            {
                for (int j = 0; j < 16; j++)
                {
                    ushort id = _cursorData[i, j];
                    //Texture2D texture = FileManager.Art.GetTexture(id);

                    ushort[] pixels = FileManager.Art.ReadStaticArt(id, out short w, out short h, out _);

                    if (i == 0)
                    {
                        if (pixels != null && pixels.Length > 0)
                        {
                            float offX = 0;
                            float offY = 0;
                            float dw   = w;
                            float dh   = h;

                            if (id == 0x206A)
                            {
                                offX = -4f;
                            }
                            else if (id == 0x206B)
                            {
                                offX = -dw + 3f;
                            }
                            else if (id == 0x206C)
                            {
                                offX = -dw + 3f;
                                offY = -(dh / 2f);
                            }
                            else if (id == 0x206D)
                            {
                                offX = -dw;
                                offY = -dh;
                            }
                            else if (id == 0x206E)
                            {
                                offX = -(dw * 0.66f);
                                offY = -dh;
                            }
                            else if (id == 0x206F)
                            {
                                offY = -dh + 4f;
                            }
                            else if (id == 0x2070)
                            {
                                offY = -dh + 4f;
                            }
                            else if (id == 0x2075)
                            {
                                offY = -4f;
                            }
                            else if (id == 0x2076)
                            {
                                offX = -12f;
                                offY = -14f;
                            }
                            else if (id == 0x2077)
                            {
                                offX = -(dw / 2f);
                                offY = -(dh / 2f);
                            }
                            else if (id == 0x2078)
                            {
                                offY = -(dh * 0.66f);
                            }
                            else if (id == 0x2079)
                            {
                                offY = -(dh / 2f);
                            }

                            switch (id)
                            {
                            case 0x206B:
                                offX = -29;
                                offY = -1;

                                break;

                            case 0x206C:
                                offX = -41;
                                offY = -9;

                                break;

                            case 0x206D:
                                offX = -36;
                                offY = -25;

                                break;

                            case 0x206E:
                                offX = -14;
                                offY = -33;

                                break;

                            case 0x206F:
                                offX = -2;
                                offY = -26;

                                break;

                            case 0x2070:
                                offX = -3;
                                offY = -8;

                                break;

                            case 0x2071:
                                offX = -1;
                                offY = -1;

                                break;

                            case 0x206A:
                                offX = -4;
                                offY = -2;

                                break;

                            case 0x2075:
                                offX = -2;
                                offY = -10;

                                break;
                            }

                            _cursorOffset[0, j] = (int)offX;
                            _cursorOffset[1, j] = (int)offY;
                        }
                        else
                        {
                            _cursorOffset[0, j] = 0;
                            _cursorOffset[1, j] = 0;
                        }
                    }

                    if (pixels != null && pixels.Length > 0)
                    {
                        _cursorPixels[i, j] = new CursorInfo()
                        {
                            Width  = w,
                            Height = h,
                            Pixels = pixels
                        };
                    }
                }
            }
        }
Esempio n. 42
0
 private static extern bool GetCursorInfo(ref CursorInfo cursorInfo);