Ejemplo n.º 1
0
        private int GetCharIndexFromPos(int x, int y)
        {
            var p = new User32.Pointl {
                X = x, Y = y
            };
            int    rawSize = Marshal.SizeOf(typeof(User32.Pointl));
            IntPtr lParam  = Marshal.AllocHGlobal(rawSize);

            Marshal.StructureToPtr(p, lParam, false);
            int r = User32.SendMessage(Handle, (int)User32.Msgs.EmCharfrompos, 0, lParam);

            Marshal.FreeHGlobal(lParam);
            return(r);
        }
Ejemplo n.º 2
0
        private Point GetPosFromCharIndex(int ix)
        {
            int    rawSize = Marshal.SizeOf(typeof(User32.Pointl));
            IntPtr wParam  = Marshal.AllocHGlobal(rawSize);
            int    r       = User32.SendMessage(Handle, (int)User32.Msgs.EmPosfromchar, (int)wParam, ix);

            User32.Pointl p1 = (User32.Pointl)Marshal.PtrToStructure(wParam, typeof(User32.Pointl));

            Marshal.FreeHGlobal(wParam);
            var p = new Point {
                X = p1.X, Y = p1.Y
            };

            return(p);
        }